Skip to content
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

Booleans parsed from environment in utterly confusing ways #476

Closed
bzed opened this issue Mar 18, 2024 · 3 comments
Closed

Booleans parsed from environment in utterly confusing ways #476

bzed opened this issue Mar 18, 2024 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@bzed
Copy link

bzed commented Mar 18, 2024

Hi,

there are various "boolean" style config settings, which are parsed in different ways. For example:

qryn/common.js

Line 104 in 9da57a7

module.exports.isOmitTablesCreation = () => process.env.OMIT_CREATE_TABLES === '1'

at least compares the value with 1. Not sure why it needs a lambda, but it works. According to the documentation the default is false, so I would expect the right setting to be 'true' and not 1.

qryn/common.js

Line 129 in 9da57a7

module.exports.readonly = process.env.READONLY || false

Even worse. READONLY=false in the environment will evaluate to true. 😿 Basically everywhere if (readonly) is being used.

I did not go trough the other boolean style config options, but please find a unified way to set such options and document it.

Thanks,

Bernd

@lmangani
Copy link
Collaborator

Thanks for raising this good point @bzed we need to sanitize bool settings in a standardized fashion.
We'll add this to the quick roadmap to improve the experience.

@lmangani lmangani added enhancement New feature or request help wanted Extra attention is needed labels Mar 18, 2024
@akvlad
Copy link
Collaborator

akvlad commented Mar 19, 2024

@bzed the problem you mentioned was... well, taken under control
since 3.2.14 all the boolean env vars should be:

  • no, n, false, 0 and missing variable is considered as false
  • yes, y, true, 1 is considered as true

I hope the solution satisfies everyone.
Thanks for the heads up.

@lmangani
Copy link
Collaborator

Closing as completed! Feel free to reopen if the issue persists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants