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

Figaro set downcased config var on Heroku? #238

Closed
fro opened this issue May 16, 2016 · 3 comments
Closed

Figaro set downcased config var on Heroku? #238

fro opened this issue May 16, 2016 · 3 comments

Comments

@fro
Copy link

fro commented May 16, 2016

Hi,

Figaro is really useful, thank you.

I'm using Heroku, and when I display the config vars:

=== someapp-staging Config Vars
DATABASE_URL:                           xxx
LANG:                                   en_US.UTF-8
NEW_RELIC_LICENSE_KEY:                  xxx
NEW_RELIC_LOG:                          stdout
RACK_ENV:                               staging
RAILS_ENV:                              staging
SENDGRID_PASSWORD:                      123456
SENDGRID_USERNAME:                      app123456@heroku.com
WEBSOLR_URL:                            https://index.websolr.com/solr/0e1122334455
sendgrid_password:                      654321
sendgrid_username:                      app654321@heroku.com
websolr_url:                            https://index.websolr.com/solr/0e1122334455

... some are defined more than once.

Heroku' advice is to set all vars with uppercased keys.
From https://devcenter.heroku.com/articles/add-ons:

Alias names must always conform to the same naming conventions as config vars.They must begin with a letter and can only contain uppercase alphanumeric characters or underscores.

1

So... when we execute figaro heroku:set --remote staging -e staging for example, why Figaro doesn't automatically set the keys to uppercase?

2

What to do next?
Must I set the vars in application.yml with mixed keys like:

staging:
  <<: *default
  app_name: 'someapp (staging)'
  SENDGRID_USERNAME: app123456@heroku.com
  SENDGRID_PASSWORD: 123456
  WEBSOLR_URL: 'https://index.websolr.com/solr/0e1122334455'
  geocoder_api_key: 'azertyuiop123456789'
  airbrake_project_id: "987654"
  airbrake_project_key: 'a123456z789456123'

Thank you

@laserlemon
Copy link
Owner

You should write your application.yml to the exact case your application will use. While Heroku suggests a certain convention, there's no guarantee that everybody will (or can) use that convention consistently across the board. For that reason, Figaro won't automatically upcase, downcase, or otherwise. Hope that makes sense!

@fro
Copy link
Author

fro commented May 16, 2016

Ok. Maybe it could be an option of figaro heroku:set command.
What do you think of something like: figaro heroku:set --option 'uppercase'
Does that make sense to add such feature?

@fro
Copy link
Author

fro commented May 16, 2016

Now I know the 'why' ;-) Here's the answer from Heroku:

The behaviour of config vars in this case is due to the underlying Linux operating system being case sensitive. "Behind the scenes" config vars are just a way of managing Unix environment variables to be set on the dynos and as such, our handling of these is fairly minimal to keep them consistent with any other Linux based hosts - if we started adapting the case automatically you might find situations where it didn't work locally whereas it did on Heroku.

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

No branches or pull requests

2 participants