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