Add 'external_port'

pull/411/head
Omar Roth 2019-03-08 11:37:52 -06:00
rodzic 79c1040796
commit bc1e62ce51
2 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -24,6 +24,7 @@ user: String,
registration_enabled: {type: Bool, default: true},
statistics_enabled: {type: Bool, default: false},
admins: {type: Array(String), default: [] of String},
external_port: {type: Int32 | Nil, default: nil},
})
end

Wyświetl plik

@ -195,6 +195,7 @@ end
def make_host_url(config, kemal_config)
ssl = config.https_only || kemal_config.ssl
port = config.external_port || kemal_config.port
if ssl
scheme = "https://"
@ -202,7 +203,8 @@ def make_host_url(config, kemal_config)
scheme = "http://"
end
if kemal_config.port != 80 && kemal_config.port != 443
# Add if non-standard port
if port != 80 && port != 443
port = ":#{kemal_config.port}"
else
port = ""