chore(avs): add avs settings
This commit is contained in:
parent
548a85ead6
commit
caa96ce184
@ -125,6 +125,12 @@ ldap:
|
||||
|
||||
ldap-re-test-failover: 60
|
||||
|
||||
avs:
|
||||
host: "_env:AVSHOST:skytest.fra.fraport.de"
|
||||
port: "_env:AVSPORT:80"
|
||||
user: "_env:AVSUSER:fradrive"
|
||||
pass: "_env:AVSPASS:123"
|
||||
|
||||
smtp:
|
||||
host: "_env:SMTPHOST:"
|
||||
port: "_env:SMTPPORT:25"
|
||||
|
||||
@ -94,6 +94,8 @@ data AppSettings = AppSettings
|
||||
, appAutoDbMigrate :: Bool
|
||||
, appLdapConf :: Maybe (PointedList LdapConf)
|
||||
-- ^ Configuration settings for accessing the LDAP-directory
|
||||
, appAvsConf :: Maybe AvsConf
|
||||
-- ^ Configuration settings for accessing AVS Server (= Ausweis Verwaltungs System)
|
||||
, appSmtpConf :: Maybe SmtpConf
|
||||
-- ^ Configuration settings for accessing a SMTP Mailserver
|
||||
, appWidgetMemcachedConf :: Maybe WidgetMemcachedConf
|
||||
@ -297,6 +299,13 @@ data LdapConf = LdapConf
|
||||
, ldapPool :: ResourcePoolConf
|
||||
} deriving (Show)
|
||||
|
||||
data AvsConf = AvsConf
|
||||
{ avsHost :: String
|
||||
, avsPort :: Int
|
||||
, avsUser :: ByteString
|
||||
, avsPass :: ByteString
|
||||
} deriving (Show)
|
||||
|
||||
data SmtpConf = SmtpConf
|
||||
{ smtpHost :: HaskellNet.HostName
|
||||
, smtpPort :: HaskellNet.PortNumber
|
||||
@ -463,6 +472,14 @@ deriveFromJSON
|
||||
}
|
||||
''HaskellNet.AuthType
|
||||
|
||||
instance FromJSON AvsConf where
|
||||
parseJSON = withObject "AvsConf" $ \o -> do
|
||||
avsHost <- o .: "host"
|
||||
avsPort <- o .: "port"
|
||||
avsUser <- o .: "user"
|
||||
avsPass <- o .: "pass"
|
||||
return AvsConf{..}
|
||||
|
||||
instance FromJSON SmtpConf where
|
||||
parseJSON = withObject "SmtpConf" $ \o -> do
|
||||
smtpHost <- o .:? "host" .!= ""
|
||||
@ -544,6 +561,7 @@ instance FromJSON AppSettings where
|
||||
Ldap.Tls host _ -> not $ null host
|
||||
Ldap.Plain host -> not $ null host
|
||||
appLdapConf <- P.fromList . mapMaybe (assertM nonEmptyHost) <$> o .:? "ldap" .!= []
|
||||
appAvsConf <- assertM (not . null . avsPass) <$> o .:? "avs"
|
||||
appSmtpConf <- assertM (not . null . smtpHost) <$> o .:? "smtp"
|
||||
let validMemcachedConf MemcachedConf{memcachedConnectInfo = Memcached.ConnectInfo{..}} = and
|
||||
[ not $ null connectHost
|
||||
|
||||
Loading…
Reference in New Issue
Block a user