diff --git a/scripts/easy-docker/lib/app/wizard/env/collect.sh b/scripts/easy-docker/lib/app/wizard/env/collect.sh index 7ee1aec1..48b46323 100755 --- a/scripts/easy-docker/lib/app/wizard/env/collect.sh +++ b/scripts/easy-docker/lib/app/wizard/env/collect.sh @@ -47,7 +47,7 @@ collect_single_host_env_lines() { case "${proxy_mode_id}" in 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 prompt_status=$? @@ -94,7 +94,7 @@ collect_single_host_env_lines() { fi ;; 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 prompt_status=$? @@ -141,7 +141,7 @@ collect_single_host_env_lines() { fi ;; 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 prompt_status=$? diff --git a/scripts/easy-docker/lib/app/wizard/env/validation.sh b/scripts/easy-docker/lib/app/wizard/env/validation.sh index 3d30cb3e..3d4a5d66 100755 --- a/scripts/easy-docker/lib/app/wizard/env/validation.sh +++ b/scripts/easy-docker/lib/app/wizard/env/validation.sh @@ -164,13 +164,17 @@ is_valid_domain_name() { ;; esac + if [ "${normalized_domain}" = "localhost" ]; then + return 0 + fi + if [ "${#normalized_domain}" -lt 5 ] || [ "${#normalized_domain}" -gt 253 ]; then return 1 fi local IFS='.' read -r -a labels <<<"${normalized_domain}" - if [ "${#labels[@]}" -ne 3 ] && [ "${#labels[@]}" -ne 4 ]; then + if [ "${#labels[@]}" -lt 2 ]; then return 1 fi @@ -206,6 +210,10 @@ is_valid_domain_name() { last_index=$((${#labels[@]} - 1)) tld="${labels[last_index]}" + if [ "${tld}" = "localhost" ]; then + return 0 + fi + if ! [[ "${tld}" =~ ^[A-Za-z]{2,63}$ ]]; then return 1 fi @@ -395,7 +403,7 @@ prompt_env_value_with_validation() { if [ -z "${invalid_domain_input}" ]; then invalid_domain_input="${normalized_value}" 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 fi ;;