Skip to content

Improve boolean environment variables reading #4632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 16, 2024

Conversation

ruslandoga
Copy link
Contributor

@ruslandoga ruslandoga commented Sep 27, 2024

Changes

This PR improves reading of boolean environment variables. This change fixes cryptic error messages like in #4618 (comment) where 1 was used to mean true in SMTP_HOST_SSL_ENABLED=1.

Tests

  • Automated tests have been added

Changelog

  • This PR does not make a user-facing change

Documentation

  • This change does not need a documentation update

Dark mode

  • This PR does not change the UI

@ruslandoga ruslandoga force-pushed the improve-env-var-reading branch 2 times, most recently from 880f459 to 5e777ac Compare September 27, 2024 04:31
@ruslandoga ruslandoga changed the title Improve boolean env var reading Improve boolean env var reading in runtime config Sep 27, 2024
@ruslandoga ruslandoga changed the title Improve boolean env var reading in runtime config Improve boolean environment variables reading Sep 27, 2024
@ruslandoga ruslandoga force-pushed the improve-env-var-reading branch from 5e777ac to b4ac7a0 Compare September 27, 2024 04:37
@ruslandoga ruslandoga force-pushed the improve-env-var-reading branch from b4ac7a0 to 1714bab Compare September 27, 2024 04:40

_ ->
raise ArgumentError,
"Invalid boolean value: #{inspect(var)}. Expected one of: 1, 0, t, f, true, false, y, n, on, off"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could extract those guard clauses and combine here, 'yes' and 'no' are missing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruslandoga ruslandoga requested a review from aerosol October 14, 2024 13:46
@ruslandoga ruslandoga marked this pull request as ready for review October 14, 2024 13:46
@ruslandoga ruslandoga requested a review from a team October 14, 2024 13:47
@ruslandoga ruslandoga added this pull request to the merge queue Oct 16, 2024
@ruslandoga ruslandoga removed this pull request from the merge queue due to a manual request Oct 16, 2024
@ruslandoga ruslandoga added this pull request to the merge queue Oct 16, 2024
Merged via the queue into master with commit ff3ee1c Oct 16, 2024
10 checks passed
@ruslandoga ruslandoga deleted the improve-env-var-reading branch October 22, 2024 09:43
ruslandoga added a commit that referenced this pull request Dec 6, 2024
* improve bool env var reading

* add yes/no and tests
@ruslandoga ruslandoga mentioned this pull request Dec 6, 2024
ruslandoga added a commit that referenced this pull request Jan 6, 2025
* improve bool env var reading

* add yes/no and tests
ruslandoga added a commit that referenced this pull request Jan 16, 2025
* improve bool env var reading

* add yes/no and tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants