gma / nesta

File Based CMS and Static Site Generator
http://nestacms.com
MIT License
902 stars 122 forks source link

Let environment variables override YAML #133

Closed seanredmond closed 11 years ago

seanredmond commented 11 years ago

This is somewhat related to #127. Since I was also somewhat surprised that you couldn't just put your own values in config.yml, I thought I'd try setting my own environment variables and seeing if I could access those. I was then surprised that if you set any NESTA_ environment variable you have to set them all or suffer error pages. Ok, it's clearly documented so I shouldn't have been that surprised, but I think it would make more sense for single environment variables to override single YAML settings.

gma commented 11 years ago

While I can see that it might not jive with expectations, I'm not sure that it's breaking any well established conventions either. I'm tending towards marking this as "won't fix", primarily because I can't see a strong need to make this refactoring, while there's a fairly big list of stuff that I do think is important to do.

gma commented 11 years ago

(thanks for filing it though)

seanredmond commented 11 years ago

I think it's a pretty solid convention that you can set things in a config file but override them selectively with environment variables -- for instance the bundler config or git config. In the git case, imagine if you had to override every one of the dozens of overridable settings if you wanted to override just one.

Agreed it's a rather minor thing, but since I ran into it... It looks like a one-line change and the only test it breaks is one that checks that the config file is ignored if an environment variable is set. It shouldn't break any deployed code. Happy to make a pull request.