40 lines
1.2 KiB
Bash
40 lines
1.2 KiB
Bash
#!/usr/bin/env sh
|
|
|
|
set -e
|
|
|
|
mkdir -p /app/conf
|
|
|
|
default_conf_dir="/app/conf.default/"
|
|
gunicorn_conf="/app/conf/gunicorn.conf.py"
|
|
logging_conf="/app/conf/logging.yaml"
|
|
|
|
if [ ! -f "$gunicorn_conf" ]; then
|
|
echo "复制默认的gunicorn.conf.py配置文件..."
|
|
if [ -f "$default_conf_dir/gunicorn.conf.py" ]; then
|
|
cp "$default_conf_dir/gunicorn.conf.py" "$gunicorn_conf"
|
|
chmod 644 "$gunicorn_conf"
|
|
echo "已成功复制gunicorn.conf.py"
|
|
else
|
|
echo "警告:默认配置文件 $default_conf_dir/gunicorn.conf.py 不存在,创建空文件"
|
|
touch "$gunicorn_conf"
|
|
chmod 644 "$gunicorn_conf"
|
|
fi
|
|
fi
|
|
|
|
if [ ! -f "$logging_conf" ]; then
|
|
echo "复制默认的logging.yaml配置文件..."
|
|
if [ -f "$default_conf_dir/logging.yaml" ]; then
|
|
cp "$default_conf_dir/logging.yaml" "$logging_conf"
|
|
chmod 644 "$logging_conf"
|
|
echo "已成功复制logging.yaml"
|
|
else
|
|
echo "警告:默认配置文件 $default_conf_dir/logging.yaml 不存在,创建空文件"
|
|
touch "$logging_conf"
|
|
chmod 644 "$logging_conf"
|
|
fi
|
|
fi
|
|
|
|
mkdir -p /app/logs /app/data/icon /app/data/text
|
|
|
|
exec "$@"
|