31 lines
526 B
Bash
31 lines
526 B
Bash
#!/bin/sh
|
|
|
|
# Helper to build a JSON list
|
|
function json_list {
|
|
[ -z $1 ] && printf '[]' && return
|
|
|
|
local list="\"$1\""
|
|
shift
|
|
|
|
for i in $@; do
|
|
list="$list, \"$i\""
|
|
done
|
|
|
|
printf "[$list]"
|
|
}
|
|
|
|
# Build config from env
|
|
cat <<EOL > /app/config.json
|
|
{
|
|
"port": $PORT,
|
|
"host": "$HOST",
|
|
"instance_name": "$INSTANCE_NAME",
|
|
"allow_anon": $ALLOW_ANON,
|
|
"debug": $DEBUG,
|
|
"admins": $(json_list $ADMINS)
|
|
}
|
|
EOL
|
|
|
|
[ ! -f data.sqlite ] && /bin/bash /app/setup.sh --dbset
|
|
python /app/server.py
|