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

do not crash when config/secrets.yml is blank. #14029

Merged
merged 1 commit into from
Feb 13, 2014

Conversation

senny
Copy link
Member

@senny senny commented Feb 12, 2014

While working on an application I was facing the following issue:

Our setup script touches a blank config/secrets.yml and then executes tasks that load the environment to populate it. In an initializer there is a condition on the existence of a secret. This currently crashes as the loading process expects the file to be populated:

/home/travis/build/4teamwork/geschaeftsverzeichnis/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0.beta1/lib/rails/application.rb:310:in `secrets': undefined method `[]' for false:FalseClass (NoMethodError)

The use-case presented above is certainly esoteric and could probably be solved otherwise. However I think we should not crash on a blank config/secrets.yml with this cryptic error.

Currently a blank config/database.yml yields:

/Users/senny/Projects/rails/activerecord/lib/active_record/connection_adapters/connection_specification.rb:231:in `resolve_env_connection': 'development' database is not configured. Available configuration: {} (ActiveRecord::AdapterNotSpecified)

After this patch a blank config/secrets.yml will result in:

[2014-02-12 17:10:16] ERROR RuntimeError: Missing `secret_key_base` for 'development' environment, set this value in `config/secrets.yml`

@senny
Copy link
Member Author

senny commented Feb 12, 2014

@guilleiguaran as discussed

/cc @josevalim @rafaelfranca

@senny senny added the railties label Feb 12, 2014
@senny senny added this to the 4.1.0 milestone Feb 12, 2014
@rafaelfranca
Copy link
Member

:shipit:

@guilleiguaran
Copy link
Member

👍

guilleiguaran added a commit that referenced this pull request Feb 13, 2014
do not crash when `config/secrets.yml` is blank.
@guilleiguaran guilleiguaran merged commit 6a1b459 into rails:master Feb 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants