Class: Kamal::Configuration::Validator::Proxy
- Inherits:
-
Kamal::Configuration::Validator
- Object
- Kamal::Configuration::Validator
- Kamal::Configuration::Validator::Proxy
- Defined in:
- lib/kamal/configuration/validator/proxy.rb
Instance Attribute Summary
Attributes inherited from Kamal::Configuration::Validator
Instance Method Summary collapse
Methods inherited from Kamal::Configuration::Validator
Constructor Details
This class inherits a constructor from Kamal::Configuration::Validator
Instance Method Details
#validate! ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/kamal/configuration/validator/proxy.rb', line 2 def validate! unless config.nil? super # Skip SSL host validation when a loadbalancer is present (SSL is # disabled when using a loadbalancer) or when a ssl_domains source # provides the hostnames at runtime. # On-demand TLS joins loadbalancer and ssl_domains as a source of hostnames # that only exist at handshake time - demanding a static host here would # reject the one shape kamal-proxy requires for it. if config["host"].blank? && config["hosts"].blank? && config["ssl"] && config["loadbalancer"].blank? && config.dig("ssl_domains", "source").blank? && ssl_config["on_demand_url"].blank? error "Must set a host to enable automatic SSL" end if (config.keys & [ "host", "hosts" ]).size > 1 error "Specify one of 'host' or 'hosts', not both" end if config.key?("loadbalancer") validate_loadbalancer! config["loadbalancer"] end if config["ssl"].is_a?(Hash) validate_ssl_hash! config["ssl"] end # Truthiness, not present? — an empty hash must still fail the # "Missing source" check rather than silently disable the feature. if config["ssl_domains"] validate_ssl_domains! config["ssl_domains"] end if config["basic_auth"].is_a?(Hash) validate_basic_auth! config["basic_auth"] end if config["cache"].is_a?(Hash) validate_cache! config["cache"] end if config["compress"].is_a?(Hash) validate_compress! config["compress"] end validate_access_control! validate_traffic_shaping! validate_canonical_host! validate_lifecycle! validate_tuning! if run_config = config["run"] if run_config["bind_ips"].present? ensure_valid_bind_ips(run_config["bind_ips"]) end if run_config["publish"] == false if run_config["bind_ips"].present? || run_config["http_port"].present? || run_config["https_port"].present? error "Cannot set http_port, https_port or bind_ips when publish is false" end end if run_config["acme"].is_a?(Hash) validate_acme! run_config["acme"] end if run_config["cache"].is_a?(Hash) validate_cache_store! run_config["cache"] end run_config end end end |