Skip to content
This repository has been archived by the owner on Mar 14, 2018. It is now read-only.

Commit

Permalink
Merge pull request #34 from amateurhuman/env-in-script-setup
Browse files Browse the repository at this point in the history
Load the environment variables from .env, if it exists, in script/setup.
  • Loading branch information
lmarburger committed Mar 13, 2013
2 parents a4bd09d + f60625e commit 3b19293
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 8 additions & 7 deletions README.md
Expand Up @@ -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
---------
Expand Down
4 changes: 4 additions & 0 deletions script/setup
Expand Up @@ -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"
Expand Down

0 comments on commit 3b19293

Please sign in to comment.