dsql-admin/dsql-app/docker-entrypoint.sh
2024-11-05 12:12:42 +01:00

36 lines
824 B
Bash
Executable File

#!/bin/bash
cd /app
npm install
./init-sql.sh
if [[ $? == 0 ]]; then
echo "Dsql Database config complete"
else
echo "Dsql Database configuration failed. Exiting ..."
exit 1
fi
node /app/shell/createDbFromSchema.js
if [ -z "${NEXT_PUBLIC_DSQL_LOCAL}" ]; then
echo "NEXT_PUBLIC_DSQL_LOCAL is not set."
if [ "${DSQL_HOST_ENV}" == "prod_prod" ]; then
echo "Main Production Environment"
nodecid
else
echo "Dev Environment"
batchrun
fi
elif [[ "${DSQL_HOST_ENV}" == "dev_dev" ]]; then
echo "NEXT_PUBLIC_DSQL_LOCAL is set in dev environment."
batchrun
else
echo "NEXT_PUBLIC_DSQL_LOCAL is set. Running Local initialization ..."
node /app/docker-root-user-init.js
node /app/shell/mariadb-users/refreshUsersAndGrants.js
npm run start:local
fi