moved config to a json, which makes adding more variables easier, but perhaps otherwise adds complexity
This commit is contained in:
@@ -3,6 +3,7 @@ PYTHON=python3
|
||||
SQLITE=sqlite3
|
||||
|
||||
export DB="/app/forum.db"
|
||||
export CONF="/app/forum.config"
|
||||
export SERVER=gunicorn
|
||||
export PID="forum.pid"
|
||||
export WORKERS=4
|
||||
@@ -15,36 +16,6 @@ fi
|
||||
|
||||
set -eu
|
||||
. /opt/venv/bin/activate
|
||||
if [[ -e "$DB" ]]; then
|
||||
$SQLITE -header "$DB" "SELECT version,name,description,registration_enabled,login_required FROM config"
|
||||
echo Database already exists
|
||||
else
|
||||
password=$($PYTHON tool.py password "$ADMINP")
|
||||
time=$($PYTHON -c 'import time; print(time.time_ns())')
|
||||
version=$($PYTHON tool.py version)
|
||||
|
||||
$SQLITE "$DB" -init schema.txt "insert into config (
|
||||
version,
|
||||
name,
|
||||
description,
|
||||
secret_key,
|
||||
captcha_key,
|
||||
registration_enabled,
|
||||
login_required
|
||||
)
|
||||
values (
|
||||
'$version',
|
||||
'Forum',
|
||||
'',
|
||||
'$(head -c 30 /dev/urandom | base64)',
|
||||
'$(head -c 30 /dev/urandom | base64)',
|
||||
0,
|
||||
1
|
||||
)"
|
||||
$SQLITE "$DB" "
|
||||
insert into users (name, password, role, join_time)
|
||||
values (lower('$ADMINU'), '$password', 2, $time)
|
||||
"
|
||||
fi
|
||||
sh ./init_forum.sh
|
||||
|
||||
exec "$SERVER" -w $WORKERS 'main:app' --pid="$PID" -b 0.0.0.0:5000
|
||||
|
||||
Reference in New Issue
Block a user