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