Permalink
Browse files

Merge pull request #773 from linchus/update-environment-comments

Actualize Hanami::Environment comments about .env file
  • Loading branch information...
TiteiKo committed Jul 28, 2017
2 parents 72243e1 + a6dd674 commit 82d6fc0dbe6972a1b7c0c9572c4c4cd58a8baa15
Showing with 15 additions and 13 deletions.
  1. +15 −13 lib/hanami/environment.rb
@@ -140,12 +140,17 @@ class Environment
# When initialized, it sets standard `ENV` variables for Rack and Hanami,
# such as `RACK_ENV` and `HANAMI_ENV`.
#
# It also evaluates configuration from `.env` and `.env.<environment>`
# It evaluates configuration ONLY from `.env.<environment>` file
# located under the config directory. All the settings in those files will
# be exported as `ENV` variables.
#
# The format of those `.env` files is compatible with `dotenv` and `foreman`
# gems.
# Master .env file is ignored to suggest clear separation of environment
# configurations and discourage putting sensitive information into source
# control.
#
# The format of those `.env.<environment>` files follows UNIX and UNIX-like
# operating system environment variable declaration format and compatible
# with `dotenv` and `foreman` gems.
#
# @param options [Hash] override default options for various environment
# attributes
@@ -164,10 +169,10 @@ class Environment
# # % tree .
# # .
# # # ...
# # ├── .env
# # ├── .env.test
# # └── .env.development
#
# # % cat .env
# # % cat .env.test
# # FOO="bar"
# # XYZ="yes"
#
@@ -188,14 +193,11 @@ class Environment
#
# # User defined ENV vars
# ENV['FOO'] # => "ok"
# ENV['XYZ'] # => "yes"
#
# # Hanami::Environment evaluates `.env` first as master configuration.
# # Then it evaluates `.env.development` because the current environment
# # is "development". The settings defined in this last file override
# # the one defined in the parent (eg `FOO` is overwritten). All the
# # other settings (eg `XYZ`) will be left untouched.
# # Variables declared on `.env` and `.env.development` will not override
# ENV['XYZ'] # => nil
#
# # Hanami::Environment evaluates `.env.development` because the current
# # environment is "development".
# # Variables declared on `.env.development` will not override
# # any variable declared on the shell when calling a `hanami` command.
# # Eg. In `FOO="not ok" bundle exec hanami c` `FOO` will not be overwritten
# # to `"ok"`.

0 comments on commit 82d6fc0

Please sign in to comment.