mirror of
https://github.com/okxlin/appstore.git
synced 2026-09-23 16:01:01 +00:00
38 lines
927 B
Bash
Executable File
38 lines
927 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ENV_FILE="${ENV_FILE:-./.env}"
|
|
|
|
ensure_env_default() {
|
|
local key="$1"
|
|
local value="$2"
|
|
|
|
if [[ ! -f "$ENV_FILE" ]]; then
|
|
echo "$ENV_FILE not found; skipped $key migration"
|
|
return
|
|
fi
|
|
|
|
if grep -qE "^${key}=" "$ENV_FILE"; then
|
|
echo "$key already exists"
|
|
return
|
|
fi
|
|
|
|
printf '%s=%s\n' "$key" "$value" >> "$ENV_FILE"
|
|
echo "Added $key"
|
|
}
|
|
|
|
if [[ -f "$ENV_FILE" ]]; then
|
|
ensure_env_default "DB_NAME" "netbox"
|
|
ensure_env_default "DB_USER" "netbox"
|
|
ensure_env_default "DB_HOST" "netbox-db"
|
|
ensure_env_default "DB_PORT" "5432"
|
|
ensure_env_default "REDIS_HOST" "netbox-redis"
|
|
ensure_env_default "REDIS_PORT" "6379"
|
|
ensure_env_default "REDIS_USERNAME" ""
|
|
ensure_env_default "REDIS_PASSWORD" ""
|
|
ensure_env_default "REDIS_DB_TASK" "0"
|
|
ensure_env_default "REDIS_DB_CACHE" "1"
|
|
else
|
|
echo "$ENV_FILE not found; skipped LinuxServer environment migration"
|
|
fi
|