This commit is contained in:
@@ -141,11 +141,17 @@ fi
|
||||
|
||||
log "Synchronisiere .env mit Vorlage"
|
||||
session_secret="$(openssl rand -hex 32)"
|
||||
if [ -f "$APP_DIR/.env" ]; then
|
||||
env_backup_path="$APP_DIR/.env.bak"
|
||||
cp -a "$APP_DIR/.env" "$env_backup_path"
|
||||
log "Backup der bisherigen .env erstellt: $env_backup_path"
|
||||
fi
|
||||
"$ENV_MERGE_SCRIPT" "$ENV_TEMPLATE" "$APP_DIR/.env" "$session_secret"
|
||||
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
chown "$RUN_USER:$RUN_GROUP" "$APP_DIR/.env"
|
||||
fi
|
||||
chmod 640 "$APP_DIR/.env"
|
||||
|
||||
log "Baue Client"
|
||||
run_as_deploy_user npm run build
|
||||
|
||||
@@ -19,6 +19,11 @@ fi
|
||||
tmp_output="$(mktemp)"
|
||||
trap 'rm -f "$tmp_output"' EXIT
|
||||
|
||||
target_mode="640"
|
||||
if [ -f "$env_file" ]; then
|
||||
target_mode="$(stat -c '%a' "$env_file" 2>/dev/null || printf '640')"
|
||||
fi
|
||||
|
||||
if [ -f "$env_file" ]; then
|
||||
awk '
|
||||
function key_from(line, key) {
|
||||
@@ -74,4 +79,5 @@ if [ -n "$session_secret" ] && grep -q '^SESSION_SECRET=$' "$tmp_output"; then
|
||||
sed -i "s/^SESSION_SECRET=$/SESSION_SECRET=$session_secret/" "$tmp_output"
|
||||
fi
|
||||
|
||||
mv "$tmp_output" "$env_file"
|
||||
cat "$tmp_output" > "$env_file"
|
||||
chmod "$target_mode" "$env_file"
|
||||
|
||||
Reference in New Issue
Block a user