add option to change the app base URL

master
rnhmjoj 2017-02-21 16:22:57 +01:00
parent 0e9c0f45e0
commit 56b0689b04
No known key found for this signature in database
GPG Key ID: 362BB82B7E496B7C
1 changed files with 19 additions and 19 deletions

View File

@ -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
}
}