-
Notifications
You must be signed in to change notification settings - Fork 653
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
Configuration capabilities using ENV vars #15881
Configuration capabilities using ENV vars #15881
Conversation
def db_config | ||
@@db_config ||= YAML.load(File.read(db_config_file)).freeze | ||
@@db_config ||= begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[rubocop] reported by reviewdog 🐶
Style/ClassVars: Replace class var @@db_config with a class instance var.
end | ||
|
||
def app_config | ||
@@app_config ||= YAML.load_file(app_config_file).freeze | ||
@@app_config ||= begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[rubocop] reported by reviewdog 🐶
Style/ClassVars: Replace class var @@app_config with a class instance var.
99c9c70
to
8a08f89
Compare
@@db_config ||= YAML.load(File.read(db_config_file)).freeze | ||
@@db_config ||= begin | ||
template = ERB.new File.new(db_config_file).read | ||
YAML.load(template.result(binding)).freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[rubocop] reported by reviewdog 🐶
Security/YAMLLoad: Prefer using YAML.safe_load over YAML.load.
@@app_config ||= YAML.load_file(app_config_file).freeze | ||
@@app_config ||= begin | ||
template = ERB.new File.new(app_config_file).read | ||
YAML.load(template.result(binding)).freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[rubocop] reported by reviewdog 🐶
Security/YAMLLoad: Prefer using YAML.safe_load over YAML.load.
else | ||
File.join(config_files_root, 'config/database.yml') | ||
end | ||
"#{config_files_root}/config/#{ENV['RAILS_DATABASE_FILE'] || 'database.yml'}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job, all these changes are improving the overall platform a lot!
Using ERB templates in file configs.
More info in CH: https://app.clubhouse.io/cartoteam/story/107871/configure-cartodb-project-with-environment-variables