Skip to content

Commit

Permalink
Read env vars from .env.pairist file if given
Browse files Browse the repository at this point in the history
This is intended to make reproducible deployment and development easier.
Now, if there is a file called .env.pairist in the current directory
when these scripts are run, it'll be sourced and env vars will be loaded
from it.

Also added a .env.pairist.sample to make this simpler.
  • Loading branch information
reidmit committed Jan 11, 2021
1 parent 92c1522 commit 02110e7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .env.pairist.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# always required:

PAIRIST_FIREBASE_PROJECT_ID="sample-project-id"
PAIRIST_FIREBASE_API_KEY="sample-api-key"

# optional (uncomment & set if not using defaults):

# PAIRIST_FIREBASE_AUTH_DOMAIN="sample-project-id.firebaseapp.com"
# PAIRIST_FIREBASE_URL="https://sample-project-id.firebaseio.com"
# PAIRIST_ALLOWED_EMAIL_DOMAINS="example.com"

# NOTE:
# see docs/configuration.md for complete list of env vars
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ node_modules
.firebase

# misc
.env.pairist
.DS_Store
.env.local
.env.development.local
Expand Down
9 changes: 9 additions & 0 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

set -e

if [ -f ".env.pairist" ]; then
echo "Loading env vars from .env.pairist file"
set -a
source ".env.pairist"
set +a
else
echo "No .env.pairist file found"
fi

if [ -z "$PAIRIST_FIREBASE_PROJECT_ID" ]; then
echo "PAIRIST_FIREBASE_PROJECT_ID is not set."
echo "This should be set to your Firebase project ID."
Expand Down
9 changes: 9 additions & 0 deletions scripts/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

set -e

if [ -f ".env.pairist" ]; then
echo "Loading env vars from .env.pairist file"
set -a
source ".env.pairist"
set +a
else
echo "No .env.pairist file found"
fi

if [ -z "$PAIRIST_FIREBASE_PROJECT_ID" ]; then
echo "PAIRIST_FIREBASE_PROJECT_ID is not set."
echo "This should be set to your Firebase project ID."
Expand Down
9 changes: 9 additions & 0 deletions scripts/start
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

set -e

if [ -f ".env.pairist" ]; then
echo "Loading env vars from .env.pairist file"
set -a
source ".env.pairist"
set +a
else
echo "No .env.pairist file found"
fi

if [ -z "$PAIRIST_FIREBASE_PROJECT_ID" ]; then
echo "PAIRIST_FIREBASE_PROJECT_ID is not set."
echo "This should be set to your Firebase project ID."
Expand Down

0 comments on commit 02110e7

Please sign in to comment.