laserlemon / figaro

Simple Rails app configuration
MIT License
3.77k stars 287 forks source link

global_configuration attempting to .reject a string #253

Closed rocketNeck closed 7 years ago

rocketNeck commented 7 years ago

I made a small change to my application.yml file and started getting this error:

/application.rb:65:in global_configuration': undefined method reject' for nil:NilClass (NoMethodError)
# application.yml
facebook_app_id: "325412xxxxxxxx"
facebook_app_secret: "5d5a7c05272axxxxxxxxxxxxxxxxxx"
google_oauth_id: "728646916282-hxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcoi.apps.googleusercontent.com"
google_oauth_secret: "GdEHWZJfxxxxxxxxxxxxxxxxxxxx"
google_maps_api_key: "AIzaSyBIg_DGlq_GlACoxxxxxxxxxxxxxxxxx"

After playing around I tried with single quotes and got same error. I then tried no quotes and rightly got:

WARNING: Use strings for Figaro configuration. 325412xxxxxxxx was converted to "325412xxxxxxxx"

…but it worked.

I then put quotes only on the facebook_app_id value because that is the only integer and now every thing is working. It looks like this:

facebook_app_id: '325412xxxxxxxx'
facebook_app_secret: 5d5a7c05272axxxxxxxxxxxxxxxxxx
google_oauth_id: 728646916282-hxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcoi.apps.googleusercontent.com
google_oauth_secret: GdEHWZJfxxxxxxxxxxxxxxxxxxxx
google_maps_api_key: AIzaSyBIg_DGlq_GlACoxxxxxxxxxxxxxxxxx

This works fine with no errors. So is it best to quote integers and not quote strings in the application.yml file?

laserlemon commented 7 years ago

I cannot reproduce the error with the following application.yml:

facebook_app_id: "32541212345678"
facebook_app_secret: "5d5a7c05272axxxxxxxxxxxxxxxxxx"
google_oauth_id: "728646916282-hxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcoi.apps.googleusercontent.com"
google_oauth_secret: "GdEHWZJfxxxxxxxxxxxxxxxxxxxx"
google_maps_api_key: "AIzaSyBIg_DGlq_GlACoxxxxxxxxxxxxxxxxx"

Can you? The only thing I can see that would cause this is if the file were completely blank.