chore(application): rename conf constructors

This commit is contained in:
Sarah Vaupel 2024-02-21 07:14:18 +01:00
parent 039b1234c5
commit a37d4b369a

View File

@ -314,14 +314,14 @@ makeFoundation appSettings''@AppSettings{..} = do
-- TODO: reintroduce failover once UserDbFailover is implemented (see above) -- TODO: reintroduce failover once UserDbFailover is implemented (see above)
ldapPool <- fmap join . forM appLdapPoolConf $ \ResourcePoolConf{..} -> if ldapPool <- fmap join . forM appLdapPoolConf $ \ResourcePoolConf{..} -> if
| UserSourceConfSingleSource{..} <- appUserSourceConf | UserAuthConfSingleSource{..} <- appUserAuthConf
, UserSourceLdap conf@LdapConf{..} <- usersrcSingleSource , AuthSourceConfLdap conf@LdapConf{..} <- userAuthConfSingleSource
-> do -- set up a singleton ldap pool with no failover -> do -- set up a singleton ldap pool with no failover
let ldapLabel = case ldapHost of let ldapLabel = case ldapConfHost of
Ldap.Plain str -> pack str <> ":" <> tshow ldapPort Ldap.Plain str -> pack str <> ":" <> tshow ldapConfPort
Ldap.Tls str _ -> pack str <> ":" <> tshow ldapPort Ldap.Tls str _ -> pack str <> ":" <> tshow ldapConfPort
$logDebugS "setup" $ "LDAP-Pool " <> ldapLabel $logDebugS "setup" $ "LDAP-Pool " <> ldapLabel
Just . (conf,) <$> createLdapPool ldapHost ldapPort poolStripes poolTimeout ldapTimeout poolLimit Just . (conf,) <$> createLdapPool ldapConfHost ldapConfPort poolStripes poolTimeout ldapConfTimeout poolLimit
| otherwise -- No LDAP pool to be initialized | otherwise -- No LDAP pool to be initialized
-> return Nothing -> return Nothing
@ -356,7 +356,7 @@ makeFoundation appSettings''@AppSettings{..} = do
return . uncurry p $ fromJust mArgs return . uncurry p $ fromJust mArgs
appAuthPlugins <- liftIO $ sequence [ appAuthPlugins <- liftIO $ sequence [
(oauth2MockServer . fromJust) <$> lookupEnv "OAUTH2_SERVER_PORT" (azureMockServer . fromJust) <$> lookupEnv "OAUTH2_SERVER_PORT"
, loadPlugin (oauth2AzureADv2Scoped ["openid", "profile", "offline_access"] tenantID) "AZURE_ADV2" , loadPlugin (oauth2AzureADv2Scoped ["openid", "profile", "offline_access"] tenantID) "AZURE_ADV2"
] ]
@ -803,7 +803,7 @@ db' = handler' . runDB
addPWEntry :: User addPWEntry :: User
-> Text {-^ Password -} -> Text {-^ Password -}
-> IO () -> IO ()
addPWEntry User{ userAuthentication = _, ..} (Text.encodeUtf8 -> pw) = db' $ do addPWEntry User{ userPasswordHash = _, ..} (Text.encodeUtf8 -> pw) = db' $ do
PWHashConf{..} <- getsYesod $ view _appAuthPWHash PWHashConf{..} <- getsYesod $ view _appAuthPWHash
(AuthPWHash . Text.decodeUtf8 -> userAuthentication) <- liftIO $ makePasswordWith pwHashAlgorithm pw pwHashStrength (Just . Text.decodeUtf8 -> userPasswordHash) <- liftIO $ makePasswordWith pwHashAlgorithm pw pwHashStrength
void $ insert User{..} void $ insert User{..}