scanConfigsForRandomPassword iterates $configs_dir (manager-owned), so the placeholder grep/sed/awk on the config file -> runInstallOp. The bcrypt export log ($containers_dir/bcrypt.txt) is docker-install-owned, so its touch/chmod/ sed/grep/append -> runFileOp/runFileWrite (NOT runInstallOp). Covers all password_replace*/password_user_replace/password_update_all and bcrypt/*. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
24 lines
867 B
Bash
24 lines
867 B
Bash
#!/bin/bash
|
|
|
|
# Laravel-style APP_KEY placeholders.
|
|
# Bookstack (and other Laravel apps) expect APP_KEY=base64:<32-byte
|
|
# base64> — refuses to boot otherwise. We swap RANDOMIZEDAPPKEY<N>
|
|
# placeholders with a freshly generated value.
|
|
replaceLaravelAppKeys()
|
|
{
|
|
local file="$1"
|
|
|
|
local existing_placeholders=$(runInstallOp grep -oE 'RANDOMIZEDAPPKEY[0-9]*' "$file" 2>/dev/null | sort -u)
|
|
|
|
if [[ -n "$existing_placeholders" ]]; then
|
|
while IFS= read -r placeholder; do
|
|
if [[ -n "$placeholder" ]]; then
|
|
local app_key
|
|
app_key="base64:$(openssl rand -base64 32)"
|
|
runInstallOp sed -i "s#${placeholder}#${app_key}#g" "$file"
|
|
checkSuccess "Updated ${placeholder} in $(basename "$file") with a new Laravel APP_KEY."
|
|
fi
|
|
done <<< "$existing_placeholders"
|
|
fi
|
|
}
|