Emit Settings on startup for debugging

This commit is contained in:
Gregor Kleen 2018-10-05 21:41:56 +02:00
parent c5b3d26f81
commit 39d493dfb7
2 changed files with 15 additions and 8 deletions

View File

@ -114,9 +114,10 @@ makeFoundation appSettings@(AppSettings{..}) = do
logFunc = messageLoggerSource tempFoundation appLogger
flip runLoggingT logFunc $ do
smtpPool <- traverse createSmtpPool appSmtpConf
$logDebugS "InstanceID" $ UUID.toText appInstanceID
$logDebugS "Configuration" $ tshow appSettings
smtpPool <- traverse createSmtpPool appSmtpConf
-- Create the database connection pool
sqlPool <- createPostgresqlPool

View File

@ -104,7 +104,7 @@ data AppSettings = AppSettings
, appCryptoIDKeyFile :: FilePath
, appInstanceIDFile :: Maybe FilePath
}
} deriving (Show)
data UserDefaultConf = UserDefaultConf
{ userDefaultTheme :: Theme
@ -118,6 +118,9 @@ data PWHashConf = PWHashConf
, pwHashStrength :: Int
}
instance Show PWHashConf where
show PWHashConf{..} = "PWHashConf { pwHashStrength = " <> show pwHashStrength <> ", .. }"
instance FromJSON PWHashConf where
parseJSON = withObject "PWHashConf" $ \o -> do
pwHashAlgorithm' <- (o .: "algorithm" :: Aeson.Parser Text)
@ -209,11 +212,14 @@ deriveFromJSON
}
''HaskellNet.AuthType
deriveFromJSON
defaultOptions
{ fieldLabelModifier = intercalate "-" . map toLower . drop 1 . splitCamel
}
''SmtpConf
instance FromJSON SmtpConf where
parseJSON = withObject "SmtpConf" $ \o -> do
smtpHost <- o .: "host"
smtpPort <- o .: "port"
smtpAuth <- assertM (not . null . smtpAuthUsername) <$> o .:? "auth"
smtpSsl <- o .: "ssl"
smtpPool <- o .: "pool"
return SmtpConf{..}
deriveFromJSON
defaultOptions