From a49388e9ce0841447bc76dea39411ed51e1a8550 Mon Sep 17 00:00:00 2001 From: katee Date: Tue, 6 Feb 2018 16:58:31 -0500 Subject: [PATCH 1/4] Add .env.sample --- .env.sample | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .env.sample diff --git a/.env.sample b/.env.sample new file mode 100644 index 00000000..cb16b3d6 --- /dev/null +++ b/.env.sample @@ -0,0 +1,6 @@ +SECRET_KEY_BASE="big long secret that you can create using 'rake secret'" +SMTP_USER_NAME="username" +SMTP_PASSWORD="this_is_not_the_password" +SMTP_ADDRESS="somedomain.com" +SMTP_DOMAIN="somedomain.com" +SMTP_PORT="465" From d2aad0cf0f3c801f2d2a746fa1006b3cd0b32bbe Mon Sep 17 00:00:00 2001 From: katee Date: Tue, 6 Feb 2018 16:58:51 -0500 Subject: [PATCH 2/4] Use dotenv-rails instead of just dotenv --- Gemfile | 2 +- Gemfile.lock | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 8bb0be8f..bc52f1f3 100644 --- a/Gemfile +++ b/Gemfile @@ -46,7 +46,7 @@ gem 'pdf-inspector', require: 'pdf/inspector' gem 'log4r' # Load ENV from a `.env` file` -gem 'dotenv' +gem 'dotenv-rails' # Automatically create text emails from HTML ones gem 'premailer-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 3b214889..2c4b198d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -70,6 +70,9 @@ GEM addressable diff-lcs (1.2.5) dotenv (2.1.2) + dotenv-rails (2.1.2) + dotenv (= 2.1.2) + railties (>= 3.2, < 5.1) erubis (2.7.0) execjs (2.7.0) factory_girl (4.8.0) @@ -299,6 +302,7 @@ DEPENDENCIES carrierwave country_select dotenv + dotenv-rails execjs factory_girl_rails faker @@ -329,4 +333,4 @@ DEPENDENCIES uglifier (>= 1.3.0) BUNDLED WITH - 1.15.3 + 1.16.0 From 7c6393a0730fa65235c4f72953f7037416ec7def Mon Sep 17 00:00:00 2001 From: katee Date: Tue, 6 Feb 2018 16:59:19 -0500 Subject: [PATCH 3/4] Add documentation about using dotenv --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index ca43722c..e21d79ac 100644 --- a/README.md +++ b/README.md @@ -66,3 +66,7 @@ You may need to precompile them for some production environments: ```sh RAILS_ENV=production bundle exec rake assets:precompile ``` + +# Secrets + +See `config/secrets.yml` for the various environment variables that must configured in proudction. `.env.sample` is provided as an example. From 4c41458ddaf073b9e679769521cef80d44459ee3 Mon Sep 17 00:00:00 2001 From: katee Date: Tue, 6 Feb 2018 20:08:21 -0500 Subject: [PATCH 4/4] Remove duplicate .env details in the Readme --- README.md | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/README.md b/README.md index e21d79ac..5a06aae0 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,7 @@ If you are running this project in production you'll need to set environment var ## Email Setup -If you're using SMTP to send emails, set the required ENV variables in config/secrets.yml or create a hidden file /[your repo]/.env (and do not add it to the repository) that overrides the values you want to set like so: - -```sh -SMTP_PASSWORD='this_is_not_the_password' -# ... more values as you need -``` +If you're using SMTP to send emails, create a hidden file `.env` (it is already ignored by git) that overrides the values you want to set. See `.env.sample` for an example. ## Event-Specific Setup (do this every year) @@ -66,7 +61,3 @@ You may need to precompile them for some production environments: ```sh RAILS_ENV=production bundle exec rake assets:precompile ``` - -# Secrets - -See `config/secrets.yml` for the various environment variables that must configured in proudction. `.env.sample` is provided as an example.