Skip to content

Commit

Permalink
Autogenerating .env
Browse files Browse the repository at this point in the history
When running ./script/run_docker.sh, automatically generate a .env file
  • Loading branch information
ineiti committed Jan 25, 2024
1 parent e4746f0 commit 47f497b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scripts/run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@ if [[ $(git rev-parse --show-toplevel) != $(pwd) ]]; then
exit 1;
fi

if [[ ! -f .env ]]; then
(
cd web/backend
npm ci
cat <<EOF > ../../.env
DELA_PROXY_URL=http://172.19.44.254:8080
DATABASE_USERNAME=dvoting
DATABASE_PASSWORD=$RANDOM # choose any PostgreSQL password
DATABASE_HOST=db
DATABASE_PORT=5432
DB_PATH=dvoting # LMDB database path
FRONT_END_URL=http://127.0.0.1:3000 # the automated frontend tests expect this value do not change it
BACKEND_HOST=backend
BACKEND_PORT=5000
SESSION_SECRET=$RANDOM # choose any secret
PROXYPORT=8080
NODEPORT=2000 # DELA node port
$( npm run keygen | tail -n 2 )
EOF
)
fi

source ./.env;
export COMPOSE_FILE=${COMPOSE_FILE:-./docker-compose/docker-compose.yml};
Expand Down

0 comments on commit 47f497b

Please sign in to comment.