mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-22 07:45:09 +00:00
fix(easy-docker): accept localhost-style site domains
This commit is contained in:
parent
ce0e9e00ee
commit
bba9e70dd8
2 changed files with 13 additions and 5 deletions
|
|
@ -47,7 +47,7 @@ collect_single_host_env_lines() {
|
||||||
|
|
||||||
case "${proxy_mode_id}" in
|
case "${proxy_mode_id}" in
|
||||||
traefik-https)
|
traefik-https)
|
||||||
if prompt_env_value_with_validation domains_value "${stack_dir}" "SITE_DOMAINS" "Required for Traefik HTTPS routing.\nUse only domains in format sub.domain.tld or sub.sub.domain.tld.\nEnter multiple domains separated by comma or space.\nType /back to return." "erp.example.com crm.eu.example.com" "required" "domains"; then
|
if prompt_env_value_with_validation domains_value "${stack_dir}" "SITE_DOMAINS" "Required for Traefik HTTPS routing.\nUse hostnames like example.com, app.example.com, localhost, or dev.localhost.\nEnter multiple domains separated by comma or space.\nLet's Encrypt still requires a public DNS name.\nType /back to return." "erp.example.com dev.localhost" "required" "domains"; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
prompt_status=$?
|
prompt_status=$?
|
||||||
|
|
@ -94,7 +94,7 @@ collect_single_host_env_lines() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
nginxproxy-https)
|
nginxproxy-https)
|
||||||
if prompt_env_value_with_validation domains_value "${stack_dir}" "SITE_DOMAINS" "Required for nginx-proxy routing.\nUse only domains in format sub.domain.tld or sub.sub.domain.tld.\nEnter multiple domains separated by comma or space.\nType /back to return." "erp.example.com crm.eu.example.com" "required" "domains"; then
|
if prompt_env_value_with_validation domains_value "${stack_dir}" "SITE_DOMAINS" "Required for nginx-proxy routing.\nUse hostnames like example.com, app.example.com, localhost, or dev.localhost.\nEnter multiple domains separated by comma or space.\nLet's Encrypt still requires a public DNS name.\nType /back to return." "erp.example.com dev.localhost" "required" "domains"; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
prompt_status=$?
|
prompt_status=$?
|
||||||
|
|
@ -141,7 +141,7 @@ collect_single_host_env_lines() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
nginxproxy-http)
|
nginxproxy-http)
|
||||||
if prompt_env_value_with_validation domains_value "${stack_dir}" "SITE_DOMAINS" "Required for nginx-proxy routing.\nUse only domains in format sub.domain.tld or sub.sub.domain.tld.\nEnter multiple domains separated by comma or space.\nType /back to return." "erp.example.com crm.eu.example.com" "required" "domains"; then
|
if prompt_env_value_with_validation domains_value "${stack_dir}" "SITE_DOMAINS" "Required for nginx-proxy routing.\nUse hostnames like example.com, app.example.com, localhost, or dev.localhost.\nEnter multiple domains separated by comma or space.\nType /back to return." "erp.example.com dev.localhost" "required" "domains"; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
prompt_status=$?
|
prompt_status=$?
|
||||||
|
|
|
||||||
|
|
@ -164,13 +164,17 @@ is_valid_domain_name() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [ "${normalized_domain}" = "localhost" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${#normalized_domain}" -lt 5 ] || [ "${#normalized_domain}" -gt 253 ]; then
|
if [ "${#normalized_domain}" -lt 5 ] || [ "${#normalized_domain}" -gt 253 ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local IFS='.'
|
local IFS='.'
|
||||||
read -r -a labels <<<"${normalized_domain}"
|
read -r -a labels <<<"${normalized_domain}"
|
||||||
if [ "${#labels[@]}" -ne 3 ] && [ "${#labels[@]}" -ne 4 ]; then
|
if [ "${#labels[@]}" -lt 2 ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -206,6 +210,10 @@ is_valid_domain_name() {
|
||||||
|
|
||||||
last_index=$((${#labels[@]} - 1))
|
last_index=$((${#labels[@]} - 1))
|
||||||
tld="${labels[last_index]}"
|
tld="${labels[last_index]}"
|
||||||
|
if [ "${tld}" = "localhost" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
if ! [[ "${tld}" =~ ^[A-Za-z]{2,63}$ ]]; then
|
if ! [[ "${tld}" =~ ^[A-Za-z]{2,63}$ ]]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -395,7 +403,7 @@ prompt_env_value_with_validation() {
|
||||||
if [ -z "${invalid_domain_input}" ]; then
|
if [ -z "${invalid_domain_input}" ]; then
|
||||||
invalid_domain_input="${normalized_value}"
|
invalid_domain_input="${normalized_value}"
|
||||||
fi
|
fi
|
||||||
validation_feedback="Domain '${invalid_domain_input}' cannot be used for ${variable_name}. Use sub.domain.tld or sub.sub.domain.tld."
|
validation_feedback="Domain '${invalid_domain_input}' cannot be used for ${variable_name}. Use a hostname like example.com, app.example.com, localhost, or dev.localhost."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue