mirror of
https://github.com/N0rthernL1ghts/wordpress.git
synced 2025-12-08 14:02:41 +01:00
24 lines
744 B
Bash
Executable File
24 lines
744 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
main() {
|
|
local secretsDir="${DOCKER_SECRETS_DIR:-./.secrets}"
|
|
local keys=("AUTH_KEY" "SECURE_AUTH_KEY" "LOGGED_IN_KEY" "NONCE_KEY" "AUTH_SALT" "SECURE_AUTH_SALT" "LOGGED_IN_SALT" "NONCE_SALT")
|
|
|
|
mkdir -p "${secretsDir}"
|
|
|
|
for key in "${keys[@]}"; do
|
|
value="$(src/wp-utils/wp-generate-salt 64)"
|
|
secretName="wordpress_${key,,}"
|
|
secretFile="${secretsDir}/${secretName}"
|
|
|
|
if [ -f "${secretFile}" ]; then
|
|
printf "Warning: Secret %s already exists and will be overwritten\n" "${secretName}"
|
|
fi
|
|
|
|
printf "Secret %s: Wrote %d bytes to %s\n" "${secretName}" "${#value}" "${secretFile}"
|
|
printf "%s" "${value}" > "${secretFile}"
|
|
done
|
|
}
|
|
|
|
main "${@}"
|