From f2740aba52638694d18b1b0b028b5f0326ce6f82 Mon Sep 17 00:00:00 2001 From: Helge Rausch Date: Thu, 28 Dec 2017 18:54:33 +0100 Subject: [PATCH] Simplify env setup (#462) * Simplify environment setup * Fix TravsCI config * Fix typo --- .env.example => .env.development | 3 --- .env.test | 12 ++++++++++++ .gitignore | 2 +- .travis.yml | 1 - INSTALL.md | 12 +++++++----- 5 files changed, 20 insertions(+), 10 deletions(-) rename .env.example => .env.development (91%) create mode 100644 .env.test diff --git a/.env.example b/.env.development similarity index 91% rename from .env.example rename to .env.development index 19b7507..c0ce601 100644 --- a/.env.example +++ b/.env.development @@ -6,11 +6,8 @@ # or not. export SECRET_KEY_BASE=foo export SECRET_TOKEN=bar -export RAILS_ENV=development export POSTGRES_URL="postgres://localhost/snpr_$RAILS_ENV" export REDIS_URL=redis://localhost -export FITBIT_CONSUMER_KEY=foo -export FITBIT_CONSUMER_SECRET=bar export PLOS_API_KEY=foo export RECAPTCHA_SECRET_KEY=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe export RECAPTCHA_SITE_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI diff --git a/.env.test b/.env.test new file mode 100644 index 0000000..55d3757 --- /dev/null +++ b/.env.test @@ -0,0 +1,12 @@ +export PATH="./bin:$PATH" +export BASE_URL=http://localhost +export SECRET_KEY_BASE=foo +export SECRET_TOKEN=bar +export POSTGRES_URL="postgres://localhost/snpr_$RAILS_ENV" +export PLOS_API_KEY=foo +export RECAPTCHA_SECRET_KEY=foo +export RECAPTCHA_SITE_KEY=bar +export MENDELEY_CONSUMER_KEY=foo +export ERRBIT_API_KEY=foo +export ERRBIT_HOST=localhost +export OH_CLIENT_ID=foo diff --git a/.gitignore b/.gitignore index 406b21d..bff503a 100644 --- a/.gitignore +++ b/.gitignore @@ -31,5 +31,5 @@ tmp/pids/server.pid vendor/bundle vendor/cache logfile -.env +.env*.local .DS_Store diff --git a/.travis.yml b/.travis.yml index 694a36d..2ea2137 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,6 @@ env: DB=postgres CI=1 bundler_args: --without development debug before_script: - cp config/database.yml.ci config/database.yml - - cp .env.example .env - bundle exec rake db:setup - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > bin/cc-test-reporter - chmod +x bin/cc-test-reporter diff --git a/INSTALL.md b/INSTALL.md index 05082ce..6d5b891 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -70,11 +70,13 @@ bundle install ## Setup config -All configuration is done via environment variables. A file with a -working environment for development can be found at `.env.example`. -Simply copy it to `.env` to use it as is. The -[dotenv](https://github.com/bkeepers/dotenv) gem will pick it up -and set the environment variables. +All configuration is done via environment variables. Files for setting up +working environments for testing and development are included (i.e. `.env.test` +and `.env.development`). The [dotenv](https://github.com/bkeepers/dotenv) gem +will pick them up and set the environment variables. If you need to override +variables locally, click +[here](https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use) for +instructions. Copy `config/database.yml.example` to `config/database.yml` and adapt to your database setup. Specially, pay attention to the database username and password