add option to change the app base URL
This commit is contained in:
parent
0e9c0f45e0
commit
56b0689b04
@ -36,27 +36,27 @@ settings = do
|
|||||||
|
|
||||||
config <- load [Required configPath]
|
config <- load [Required configPath]
|
||||||
host <- lookupDefault "localhost" config "hostname"
|
host <- lookupDefault "localhost" config "hostname"
|
||||||
port <- lookupDefault 3000 config "port"
|
portnum <- lookupDefault 3000 config "port"
|
||||||
urls <- lookupDefault urlsPath config "urltable"
|
urls <- lookupDefault urlsPath config "urltable"
|
||||||
cert <- lookupDefault "/usr/share/tls/breve.crt" config "tls.cert"
|
cert <- lookupDefault "/usr/share/tls/breve.crt" config "tls.cert"
|
||||||
key <- lookupDefault "/usr/share/tls/breve.key" config "tls.key"
|
key <- lookupDefault "/usr/share/tls/breve.key" config "tls.key"
|
||||||
chain <- lookupDefault [] config "tls.chain"
|
chain <- lookupDefault [] config "tls.chain"
|
||||||
|
|
||||||
createEmptyIfMissing urls
|
let
|
||||||
|
port = if portnum == 443 then "" else ":" <> pack (show portnum)
|
||||||
|
url = "https://" <> host <> port <> "/"
|
||||||
|
|
||||||
let base = "https://" <> host
|
baseURL <- lookupDefault url config "baseurl"
|
||||||
url = if port == 443
|
|
||||||
then base
|
createEmptyIfMissing urls
|
||||||
else base <> ":" <> pack (show port)
|
|
||||||
tls = (tlsSettingsChain cert chain key)
|
|
||||||
{ tlsAllowedVersions = [TLS12, TLS11]
|
|
||||||
, tlsCiphers = ciphersuite_strong
|
|
||||||
}
|
|
||||||
|
|
||||||
return AppSettings
|
return AppSettings
|
||||||
{ bindHost = host
|
{ bindHost = host
|
||||||
, bindPort = port
|
, bindPort = portnum
|
||||||
, bindUrl = url <> "/"
|
, bindUrl = baseURL
|
||||||
, urlTable = urls
|
, urlTable = urls
|
||||||
, tlsSettings = tls
|
, tlsSettings = (tlsSettingsChain cert chain key)
|
||||||
|
{ tlsAllowedVersions = [TLS12, TLS11]
|
||||||
|
, tlsCiphers = ciphersuite_strong
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user