mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-14 01:20:27 +00:00
24 lines
647 B
Bash
24 lines
647 B
Bash
|
#!/bin/bash
|
||
|
set -Eeuo pipefail
|
||
|
cd /opt/powerdns-admin
|
||
|
|
||
|
DB_MIGRATION_DIR='./migrations'
|
||
|
|
||
|
if [ ! -f ./config.py ]; then
|
||
|
cat ./config_template.py ./docker/Production/config_docker.py > ./config.py
|
||
|
fi
|
||
|
|
||
|
if [ "$1" == gunicorn ]; then
|
||
|
if [ ! -d "${DB_MIGRATION_DIR}" ]; then
|
||
|
flask db init --directory ${DB_MIGRATION_DIR}
|
||
|
flask db migrate -m "Init DB" --directory ${DB_MIGRATION_DIR}
|
||
|
flask db upgrade --directory ${DB_MIGRATION_DIR}
|
||
|
./init_data.py
|
||
|
else
|
||
|
flask db migrate -m "Upgrade DB Schema" --directory ${DB_MIGRATION_DIR}
|
||
|
flask db upgrade --directory ${DB_MIGRATION_DIR}
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
exec "$@"
|