-
Notifications
You must be signed in to change notification settings - Fork 112
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
Add ability for app to run without application.yml file #907
Conversation
Related to #903 |
Currently, app can't run on Heroku unless application.yml is committed, whereas the preferred method of working is by setting envvars in `.env`.
a2a21a2
to
bfff5b0
Compare
Good point. We upload class FigaroYamlValidator
ENV_KEYS = ENV.keys.delete_if { |key| key.include?('_FIGARO') }
def validate(keys = ENV_KEYS)
bad_keys = []
check_for_bad_values(keys, bad_keys)
return unless bad_keys.any?
raise warning(bad_keys).tr("\\\n", ' ')
end
private
def check_for_bad_values(keys, bad_keys)
keys.each { |key| bad_keys << key if %w(yes no).include?(ENV[key]) }
end
def warning(bad_keys)
<<~HEREDOC
You have invalid values for #{bad_keys.uniq.to_sentence} in
config/application.yml. Please change them to 'true' or 'false'
HEREDOC
end
end We should also probably rename the class to something like |
@patcon What do you think about my solution? If you like it, wanna update your PR to incorporate it? |
Slightly different so that spec works cleanly. Lemme know if you'd like a different approach! |
LGTM. Could you please address the Code Climate issue? Not sure if you can see what it is. It's complaining about the comma at the end of the hash on line 15 of the spec. |
Looks great, thanks! |
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.
👍
* Allow app to run without application.yml file **Why**: Currently, app can't run on Heroku unless application.yml is committed, whereas the preferred method of working is by setting env vars.
* Allow app to run without application.yml file **Why**: Currently, app can't run on Heroku unless application.yml is committed, whereas the preferred method of working is by setting env vars.
Currently, app can't run on Heroku unless application.yml is committed,
whereas the preferred method of working is by setting envvars in
.env
.