Permalink
Browse files

Merge branch 'selective-env'

For a long time now Nesta has prevented you from spreading your settings
between `config.yml` and the environment. If you set a single
`NESTA_...` environment variable, Nesta would expect all your
configuration to come from the environment.

This behaviour was added back in commit 4ffa508, on the "heroku" branch.

I have a sneaky suspicion that members of the community persuaded me
that having a config file on Heroku was just not the done thing. It
seems insane now, and the blog post where the idea was put forward (and
in whose comments the debate was held) no longer exists.

With the benefit of hindsight, this limitation seems insane!

As Glenn has pointed out, anybody who wants to use the environment to
configure their apps can use Erb tags within `config.yml` to read values
from `ENV`, and insert them at run time.

In the future, I'd like to remove all the code that reads the
environment variables directly, and just recommend that people who want
to use the environment do that.

Nice one, Mr Gillen. :-)
  • Loading branch information...
gma committed Jan 20, 2015
2 parents 826043a + eefcf48 commit bac5097470c8747cb284e69f03f26967141353ed
Showing with 4 additions and 4 deletions.
  1. +1 −1 lib/nesta/config.rb
  2. +3 −3 spec/config_spec.rb
View
@@ -91,7 +91,7 @@ def self.yaml_exists?
private_class_method :yaml_exists?
def self.can_use_yaml?
- ENV.keys.grep(/^NESTA/).empty? && yaml_exists?
+ yaml_exists?
end
private_class_method :can_use_yaml?
View
@@ -18,10 +18,10 @@
@title = "Title from ENV"
ENV["NESTA_TITLE"] = @title
end
-
- it "should never try and access config.yml" do
+
+ it "should fallback to config.yml" do
stub_config_key("subtitle", "Subtitle in YAML file")
- Nesta::Config.subtitle.should be_nil
+ Nesta::Config.subtitle.should == "Subtitle in YAML file"
end
it "should override config.yml" do

0 comments on commit bac5097

Please sign in to comment.