different .env include in scripts

This commit is contained in:
Ulf Gebhardt 2022-01-14 18:50:11 +01:00
parent 90effb41b5
commit 0bd9fed251
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
4 changed files with 20 additions and 21 deletions

View File

@ -10,19 +10,19 @@ PROJECT_ROOT=$SCRIPT_DIR/../..
set +o allexport
# Load backend .env for DB_USERNAME, DB_PASSWORD & DB_DATABASE
set -o allexport
# NOTE: all config values will be in process.env when starting
# the services and will therefore take precedence over the .env
if [ -f "$PROJECT_ROOT/backend/.env" ]; then
source $PROJECT_ROOT/backend/.env
export $(cat $PROJECT_ROOT/backend/.env | sed 's/#.*//g' | xargs)
else
source $PROJECT_ROOT/backend/.env.dist
export $(cat $PROJECT_ROOT/backend/.env.dist | sed 's/#.*//g' | xargs)
fi
set +o allexport
# Stop Services
pm2 stop all
pm2 stop gradido-backend
# Backup data
mysqldump --databases --single-transaction --quick --lock-tables=false > ${SCRIPT_DIR}/backup/mariadb-backup-$(date +%d-%m-%Y_%H-%M-%S).sql -u ${DB_USER} -p${DB_PASSWORD} ${DB_DATABASE}
# Start Services
pm2 start all
pm2 start gradido-backend

View File

@ -11,13 +11,13 @@ PROJECT_ROOT=$SCRIPT_DIR/../..
set +o allexport
# Load .env or .env.dist if not present
set -o allexport
# NOTE: all config values will be in process.env when starting
# the services and will therefore take precedence over the .env
if [ -f "$SCRIPT_DIR/.env" ]; then
source $SCRIPT_DIR/.env
export $(cat $SCRIPT_DIR/.env | sed 's/#.*//g' | xargs)
else
source $SCRIPT_DIR/.env.dist
export $(cat $SCRIPT_DIR/.env.dist | sed 's/#.*//g' | xargs)
fi
set +o allexport
# Configure git
git config pull.ff only

View File

@ -10,16 +10,16 @@ PROJECT_ROOT=$SCRIPT_DIR/../..
set +o allexport
# Load backend .env for DB_USERNAME, DB_PASSWORD & DB_DATABASE
set -o allexport
# NOTE: all config values will be in process.env when starting
# the services and will therefore take precedence over the .env
if [ -f "$PROJECT_ROOT/backend/.env" ]; then
source $PROJECT_ROOT/backend/.env
export $(cat $PROJECT_ROOT/backend/.env | sed 's/#.*//g' | xargs)
else
source $PROJECT_ROOT/backend/.env.dist
export $(cat $PROJECT_ROOT/backend/.env.dist | sed 's/#.*//g' | xargs)
fi
set +o allexport
# Stop Services
pm2 stop all
pm2 stop gradido-backend
# Backup data
mysqldump --databases --single-transaction --quick --lock-tables=false > ${SCRIPT_DIR}/backup/mariadb-restore-backup-$(date +%d-%m-%Y_%H-%M-%S).sql -u ${DB_USER} -p${DB_PASSWORD} ${DB_DATABASE}
@ -33,4 +33,4 @@ EOFMYSQL
yarn --cwd $PROJECT_ROOT/database up
# Start Services
pm2 start all
pm2 start gradido-backend

View File

@ -11,14 +11,13 @@ NGINX_CONFIG_DIR=$SCRIPT_DIR/nginx/sites-available
set +o allexport
# Load .env or .env.dist if not present
set -o allexport
#TODO
# NOTE: all config values will be in process.env when starting
# the services and will therefore take precedence over the .env
if [ -f "$SCRIPT_DIR/.env" ]; then
source $SCRIPT_DIR/.env
export $(cat $SCRIPT_DIR/.env | sed 's/#.*//g' | xargs)
else
source $SCRIPT_DIR/.env.dist
export $(cat $SCRIPT_DIR/.env.dist | sed 's/#.*//g' | xargs)
fi
set +o allexport
# lock start
if [ -f $LOCK_FILE ] ; then