fix prod domain mismatch
This commit is contained in:
@@ -25,6 +25,66 @@ ensure_env_file() {
|
||||
echo "Create it from .env.docker.production.example before starting production containers." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
validate_prod_env_file
|
||||
}
|
||||
|
||||
read_env_value() {
|
||||
local key="$1"
|
||||
local value
|
||||
|
||||
value="$(
|
||||
awk -F= -v key="$key" '
|
||||
$1 == key {
|
||||
value = substr($0, index($0, "=") + 1)
|
||||
}
|
||||
END {
|
||||
if (value != "") {
|
||||
print value
|
||||
}
|
||||
}
|
||||
' "${ENV_FILE}"
|
||||
)"
|
||||
|
||||
value="${value%$'\r'}"
|
||||
value="${value#\"}"
|
||||
value="${value%\"}"
|
||||
printf '%s' "${value}"
|
||||
}
|
||||
|
||||
validate_prod_env_file() {
|
||||
local api_domain public_site_domain cors_origins pgmanage_domain portainer_domain
|
||||
|
||||
api_domain="$(read_env_value API_DOMAIN)"
|
||||
public_site_domain="$(read_env_value PUBLIC_SITE_DOMAIN)"
|
||||
cors_origins="$(read_env_value CORS_ORIGINS)"
|
||||
pgmanage_domain="$(read_env_value PGMANAGE_DOMAIN)"
|
||||
portainer_domain="$(read_env_value PORTAINER_DOMAIN)"
|
||||
|
||||
if [[ -z "${api_domain}" || "${api_domain}" == *example.com* ]]; then
|
||||
echo "Invalid API_DOMAIN in ${ENV_FILE}. Set it to the real production API hostname, not example.com." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${public_site_domain}" || "${public_site_domain}" == *example.com* ]]; then
|
||||
echo "Invalid PUBLIC_SITE_DOMAIN in ${ENV_FILE}. Set it to the real production site hostname, not example.com." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${cors_origins}" || "${cors_origins}" == *example.com* ]]; then
|
||||
echo "Invalid CORS_ORIGINS in ${ENV_FILE}. Replace example.com origins with the real production domains." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "${pgmanage_domain}" && "${pgmanage_domain}" == *example.com* ]]; then
|
||||
echo "Invalid PGMANAGE_DOMAIN in ${ENV_FILE}. Set a real hostname or disable the pgmanage router." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "${portainer_domain}" && "${portainer_domain}" == *example.com* ]]; then
|
||||
echo "Invalid PORTAINER_DOMAIN in ${ENV_FILE}. Set a real hostname or disable the portainer router." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_traefik_network() {
|
||||
|
||||
Reference in New Issue
Block a user