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

Additional options for parsing env variables #125

Merged

Conversation

spalladino
Copy link
Contributor

Allows setting env vars like "SETTINGS__FOLDER__MY_KEY".

  • env_prefix: change the prefix for the env vars to be processed
  • env_separator: set the symbol or symbols on which to split
  • env_converter: set to :downcase to change MY_KEY to my_key
  • env_parse_values: convert integer-like env values to integers

This is similar to #119, but builds on the existing env_load! method and provides further customisation on the format of the env variables. It should fix #108.

… like "SETTINGS__FOLDER__MY_KEY".

- env_prefix: change the prefix for the env vars to be processed
- env_separator: set the symbol or symbols on which to split
- env_converter: set to :downcase to change MY_KEY to my_key
- env_parse_values: convert integer-like env values to integers
@spalladino
Copy link
Contributor Author

Please let me know if there is interest in this feature, in which case I'll rebase the changes on top of master so it can be merged.

@cbeer
Copy link

cbeer commented May 2, 2016

This also fixes #138 , I think?

[Edit: fixed ID]

@spalladino
Copy link
Contributor Author

@cbeer I think you mixed up the case ID

@cbeer
Copy link

cbeer commented May 2, 2016

Fixed, thanks. This would be really useful for using e.g. AWS ElasticBeanstalk with config.

@spalladino
Copy link
Contributor Author

👍 Yes, it should fix #138 as well. We are running several of our apps as Docker containers in Dockercloud, and it is far easier to set env vars than to mount a config file.

@pkuczynski pkuczynski merged commit 85b46e1 into rubyconfig:master May 12, 2016
pkuczynski added a commit that referenced this pull request May 12, 2016
Additional options for parsing env variables #125
@pkuczynski
Copy link
Member

This is a really good idea and implementation! I just merged it in and will prepare release 1.2.0. I also updated some documentation and added new options to Rails initializer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Read environment variables
3 participants