.),
makeLenses,
)
( encodeString,
fromText,
)
data ServerConfig
= ServerConfig
{ _hostname :: C8.ByteString,
do
env <- getEnvironment
cfg <- C.load [C.Required $ encodeString cfgFile]
let dbEnvCfg = pgsDefaultConfig . C8.pack <$> L.lookup "DATABASE_URL" env
readServerConfig cfg dbEnvCfg
ServerConfig
<$> C.lookupDefault "localhost" cfg "hostname"
<*> C.lookupDefault 8000 cfg "port"
<*> (fromText <$> C.require cfg "siteKey")
<*> C.lookup cfg "cookieTimeout"
<*> maybe (mkPGSConfig $ C.subconfig "db" cfg) pure pc
<*> readSmtpConfig cfg
<*> (readBillingConfig $ C.subconfig "billing" cfg)
<*> ( fromText
<$> C.lookupDefault
"/opt/aftok/server/templates/"
cfg
"templatePath"
)
<*> ( fromText
<$> C.lookupDefault
"/opt/aftok/server/static/"
cfg
"staticAssetPath"
)
<*> (CaptchaConfig <$> C.require cfg "recaptchaSecret")
<*> (readZcashdConfig $ C.subconfig "zcashd" cfg)
ZcashdConfig <$> C.require cfg "rpcHost"
<*> C.require cfg "rpcPort"
<*> C.require cfg "rpcUser"
<*> C.require cfg "rpcPassword"
SC.setHostname (qc ^. hostname) . SC.setPort (qc ^. port)
-- configuration specific to Snap, commandLineConfig arguments override
-- config file.
SC.commandLineConfig $ baseSnapConfig qc SC.emptyConfig
( (^