Fix config placeholder replacement with special chars
This commit is contained in:
@@ -28,14 +28,34 @@ mkdir -p "$install_dir" "$data_dir/data" "$data_dir/media/originals" "$data_dir/
|
||||
cp -a "$YNH_APP_BASEDIR/backend" "$YNH_APP_BASEDIR/web" "$YNH_APP_BASEDIR/doc" "$install_dir"/
|
||||
|
||||
cp "$YNH_APP_BASEDIR/conf/config.json" "$config_dir/config.json"
|
||||
sed -i \
|
||||
-e "s#__PORT__#$port#g" \
|
||||
-e "s#__PATH__#$path#g" \
|
||||
-e "s#__DATA_DIR__#$data_dir#g" \
|
||||
-e "s#__INSTALL_DIR__#$install_dir#g" \
|
||||
-e "s#__ADMIN_USER__#$admin_user#g" \
|
||||
-e "s#__ADMIN_PASSWORD__#$admin_password#g" \
|
||||
"$config_dir/config.json"
|
||||
CONFIG_FILE="$config_dir/config.json" \
|
||||
APP_PORT="$port" \
|
||||
APP_PATH="$path" \
|
||||
APP_DATA_DIR="$data_dir" \
|
||||
APP_INSTALL_DIR="$install_dir" \
|
||||
APP_ADMIN_USER="$admin_user" \
|
||||
APP_ADMIN_PASSWORD="$admin_password" \
|
||||
python3 - <<'PYCONF'
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
config_file = Path(os.environ["CONFIG_FILE"])
|
||||
content = config_file.read_text()
|
||||
|
||||
replacements = {
|
||||
"__PORT__": os.environ["APP_PORT"],
|
||||
"__PATH__": os.environ["APP_PATH"],
|
||||
"__DATA_DIR__": os.environ["APP_DATA_DIR"],
|
||||
"__INSTALL_DIR__": os.environ["APP_INSTALL_DIR"],
|
||||
"__ADMIN_USER__": os.environ["APP_ADMIN_USER"],
|
||||
"__ADMIN_PASSWORD__": os.environ["APP_ADMIN_PASSWORD"],
|
||||
}
|
||||
|
||||
for key, value in replacements.items():
|
||||
content = content.replace(key, value)
|
||||
|
||||
config_file.write_text(content)
|
||||
PYCONF
|
||||
|
||||
cp "$YNH_APP_BASEDIR/conf/albumik.service" "$service_file"
|
||||
sed -i \
|
||||
|
||||
Reference in New Issue
Block a user