Permalink
Browse files

Merge pull request #34 from amateurhuman/env-in-script-setup

Load the environment variables from .env, if it exists, in script/setup.
  • Loading branch information...
2 parents a4bd09d + f60625e commit 3b192937e692a3b46828a26fc76d09ea60015f82 @lmarburger lmarburger committed Mar 13, 2013
Showing with 12 additions and 7 deletions.
  1. +8 −7 README.md
  2. +4 −0 script/setup
View
@@ -4,14 +4,15 @@ bundler-api
Environment
-----------
-The follow environment variables are needed to run bundler-api.
+The follow environment variables are needed to run bundler-api. You can
+store these in the .gitignored ````.env```` file to have them automatically
+loaded by Foreman and ````script/setup````.
+
+ RACK_ENV=development
+ DATABASE_URL=postgres:///bundler-api
+ FOLLOWER_DATABASE_URL=postgres:///bundler-api
+ TEST_DATABASE_URL=postgres:///bundler-api-test
-```
-RACK_ENV=development
-DATABASE_URL=postgres:///bundler-api
-FOLLOWER_DATABASE_URL=postgres:///bundler-api
-TEST_DATABASE_URL=postgres:///bundler-api-test
-```
Databases
---------
View
@@ -7,6 +7,10 @@ else
exec 3>/dev/null
fi
+if [ -e ".env" ]; then
+ while read line; do export $line; done < ".env"
+fi
+
# DATABASE_URL env var is required to setup the database
if [ -z "$DATABASE_URL" ]; then
echo "DATABASE_URL environment variable required"

0 comments on commit 3b19293

Please sign in to comment.