laserlemon / figaro

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

feature suggestion heroku:get #239

Open scarroll32 opened 8 years ago

scarroll32 commented 8 years ago

It would be nice to be able to pull a configuration manually entered into Heroku back to the workstation. This should be possible via the Heroku Platform API.

Please let me know what you think about this ... I will have a go at coding it.

TheNotary commented 8 years ago

The heroku toolbet gem can get env vars with heroku config:get I think. Since that work has already been done, I think a best approach to this problem is to create a figaro:env_to_yml command that takes in (perhaps from STDIN) a string of env variables and outputs an appliaction.yml file. This saves us the step of having to conver = signs to : signs and such. Ultimately the workflow would become:

my_app $  heroku config -s | figaro config:env_to_yml > heroku_application.yml

The reason I think to do it this way using pipes and such is that there are getting to be many PaaS code bases out there and Figaro should probably try to be as agnostic and multi-purposed as possible.

What do you think, and did you make any progress? I'm thinking I might make a figaro-config-addons gem to add this functionality to figaro faster to allow time for review, discussion and bug fixing.

It's important that we have a backwards and forwards compatible way (a way to set configs). As it stands, figaro heroku:set automatically slurps up the application.yml file, converting it to an env format (without new line characters) and then sets the variables in heroku using herokutoolbelt CLI app (an explicit dependency). Since Heroku is popular, this method is arguably helpful, but it isn't useful when the developer needs to import vars into dokku, Deis, etc, etc. To this developer, an additional command figaro config:yml_to_env would be helpful. I'll rewrite my PR... add tests... then see about pulling it into it's own figaro-config-addons gem and put it up for review.