Refactor: Use heredoc when creating env files and creds/other (#15469)

* Use heredoc

* Fixes
This commit is contained in:
Slaviša Arežina
2026-06-30 13:01:18 +02:00
committed by GitHub
parent 02bbb774c9
commit 4d56173394
65 changed files with 418 additions and 424 deletions
+5 -6
View File
@@ -58,12 +58,11 @@ function update_script() {
-e 's/^NODE_/APP_/' \
-e '/^SERVER_*/d' \
-e '/^# API*/,+2d' /opt/patchmon/.env
{
echo ""
echo "SESSION_SECRET=$(openssl rand -hex 64)"
echo "AI_ENCRYPTION_KEY=$(openssl rand -hex 64)"
echo "AGENT_BINARIES_DIR=/opt/patchmon/agents"
} >>/opt/patchmon/.env
cat <<EOF >/opt/patchmon/.env
SESSION_SECRET=$(openssl rand -hex 64)
AI_ENCRYPTION_KEY=$(openssl rand -hex 64)
AGENT_BINARIES_DIR=/opt/patchmon/agents
EOF
sed -i -e '\|Directory|s|/backend||' \
-e 's|^ExecStart=.*|ExecStart=/opt/patchmon/patchmon-server|' \
-e 's|^Environment=NODE_.*|EnvironmentFile=/opt/patchmon/.env|' \
+5 -5
View File
@@ -57,11 +57,11 @@ function update_script() {
sed -i 's/--workers 4//' /opt/wizarr/start.sh
fi
if ! grep -qE 'FLASK|WORKERS|VERSION' /opt/wizarr/.env; then
{
echo "FLASK_ENV=production"
echo "GUNICORN_WORKERS=4"
echo "APP_VERSION=$(sed 's/^20/v&/' ~/.wizarr)"
} >>/opt/wizarr/.env
cat <<EOF >/opt/wizarr/.env
FLASK_ENV=production
GUNICORN_WORKERS=4
APP_VERSION=$(sed 's/^20/v&/' ~/.wizarr)
EOF
else
sed -i "s/_VERSION=v.*$/_VERSION=v$(cat ~/.wizarr)/" /opt/wizarr/.env
fi