Skip to content

Commit

Permalink
Update instruction for loading dotenv
Browse files Browse the repository at this point in the history
Loading dotenv in production raise error for the obvious reason that we install it only for development and test environment. So I think this instruction should be included in the readme file so that we load it only if we are in the desired environments.
  • Loading branch information
ahangarha committed Jun 25, 2022
1 parent c237d6d commit 2b24d1e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ dotenv is initialized in your Rails app during the `before_configuration` callba
# config/application.rb
Bundler.require(*Rails.groups)

Dotenv::Railtie.load
# Load dotenv only in development or test environment
if ['development', 'test'].include? ENV['RAILS_ENV']
Dotenv::Railtie.load
end

HOSTNAME = ENV['HOSTNAME']
```
Expand Down

0 comments on commit 2b24d1e

Please sign in to comment.