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

Environment variable setting overrides cannot set values to Boolean false #1462

Closed
tdonohue opened this issue Oct 19, 2017 · 0 comments · Fixed by #1463 or #1465
Closed

Environment variable setting overrides cannot set values to Boolean false #1462

tdonohue opened this issue Oct 19, 2017 · 0 comments · Fixed by #1463 or #1465
Assignees

Comments

@tdonohue
Copy link
Contributor

tdonohue commented Oct 19, 2017

All settings in config/settings.yml can be overridden using environment variables, as defined in config/initializers/config.rb: https://github.com/samvera-labs/hyku/blob/master/config/initializers/config.rb

However, currently any Settings that default to boolean true (e.g. admin_only_tenant_creation) cannot be overridden via an environment variable. So, in the case of admin_only_tenant_creation, creating an environment variable SETTINGS__MULTITENANCY__ADMIN_ONLY_TENANT_CREATION=false would have no effect.

This seems to be the result of a bug in the config gem which is described here: rubyconfig/config#178

Simply put, any environment variable overrides that are set to false are ready as "false" (the String), and all Strings are truthy. So, the String "false" becomes boolean true.

After some discussion with @mjgiarlo, we've decided to try to monkey-patch this method : https://github.com/railsconfig/config/blob/3131b54a8d5efbba88dbced80019a5451f04c708/lib/config/options.rb#L191 We'll also send a patch back to the config gem in the hopes that it can properly support Booleans in the future.

@tdonohue tdonohue changed the title Environment variable Setting overrides cannot set values to false Environment variable setting overrides cannot set values to Boolean false Oct 19, 2017
@tdonohue tdonohue self-assigned this Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants