Skip to content

Commit

Permalink
Merge pull request #281 from bkeepers/allow-local-per-env
Browse files Browse the repository at this point in the history
Allow local per env
  • Loading branch information
bkeepers authored Jan 25, 2017
2 parents c195b46 + 7bc3431 commit bc88d66
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/dotenv/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Railtie < Rails::Railtie
# can manually call `Dotenv::Railtie.load` if you needed it sooner.
def load
Dotenv.load(
root.join(".env.#{Rails.env}.local"),
root.join(".env.local"),
root.join(".env.#{Rails.env}"),
root.join(".env")
Expand Down
1 change: 1 addition & 0 deletions spec/dotenv/rails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def add(*items)
it "loads .env, .env.local, and .env.#{Rails.env}" do
expect(Spring.watcher.items).to eql(
[
Rails.root.join(".env.test.local").to_s,
Rails.root.join(".env.local").to_s,
Rails.root.join(".env.test").to_s,
Rails.root.join(".env").to_s
Expand Down
3 changes: 3 additions & 0 deletions spec/fixtures/.env.test.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM_RAILS_ENV=.env.test
FROM_LOCAL=true
DOTENV=local

0 comments on commit bc88d66

Please sign in to comment.