Cleanup for documentation
This commit is contained in:
parent
c6918affd5
commit
c21b645446
@ -49,6 +49,8 @@ stanzas:
|
||||
- SMTPPASS
|
||||
- SMTPTIMEOUT
|
||||
- SMTPLIMIT
|
||||
- MAILSUPPORT
|
||||
- MAILSUPPORT_NAME
|
||||
- INSTANCE_ID
|
||||
- MEMCACHEDHOST
|
||||
- MEMCACHEDPORT
|
||||
|
||||
@ -48,6 +48,8 @@ stanzas:
|
||||
- SMTPPASS
|
||||
- SMTPTIMEOUT
|
||||
- SMTPLIMIT
|
||||
- MAILSUPPORT
|
||||
- MAILSUPPORT_NAME
|
||||
- INSTANCE_ID
|
||||
- MEMCACHEDHOST
|
||||
- MEMCACHEDPORT
|
||||
|
||||
@ -16,8 +16,8 @@ mail-verp:
|
||||
separator: "+"
|
||||
at-replacement: "="
|
||||
mail-support:
|
||||
name: null
|
||||
email: "uni2work@ifi.lmu.de"
|
||||
name: "_env:MAILSUPPORT_NAME:"
|
||||
email: "_env:MAILSUPPORT:uni2work@ifi.lmu.de"
|
||||
|
||||
job-workers: "_env:JOB_WORKERS:10"
|
||||
job-flush-interval: "_env:JOB_FLUSH:30"
|
||||
|
||||
@ -12,6 +12,8 @@ import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
|
||||
import Utils.PathPiece
|
||||
|
||||
import Utils (assertM)
|
||||
|
||||
|
||||
deriving instance Read Address
|
||||
@ -20,6 +22,12 @@ deriving instance Generic Address
|
||||
|
||||
instance Hashable Address
|
||||
|
||||
deriveJSON defaultOptions
|
||||
deriveToJSON defaultOptions
|
||||
{ fieldLabelModifier = intercalate "-" . map toLower . drop 1 . splitCamel
|
||||
} ''Address
|
||||
|
||||
instance FromJSON Address where
|
||||
parseJSON = withObject "Address" $ \obj -> do
|
||||
addressName <- assertM (not . null) <$> (obj .:? "name")
|
||||
addressEmail <- obj .: "email"
|
||||
return Address{..}
|
||||
|
||||
@ -59,11 +59,15 @@ import qualified Database.Memcached.Binary.Types as Memcached
|
||||
import Model
|
||||
import Settings.Cluster
|
||||
|
||||
import Control.Monad.Trans.Maybe (MaybeT(..))
|
||||
|
||||
import qualified System.FilePath as FilePath
|
||||
|
||||
-- | Runtime settings to configure this application. These settings can be
|
||||
-- loaded from various sources: defaults, environment variables, config files,
|
||||
-- theoretically even a database.
|
||||
data AppSettings = AppSettings
|
||||
{ appStaticDir :: String
|
||||
{ appStaticDir :: FilePath
|
||||
-- ^ Directory from which to serve static files.
|
||||
, appDatabaseConf :: PostgresConf
|
||||
-- ^ Configuration settings for accessing the database.
|
||||
@ -360,7 +364,13 @@ instance FromJSON AppSettings where
|
||||
appUserDefaults <- o .: "user-defaults"
|
||||
appAuthPWHash <- o .: "auth-pw-hash"
|
||||
|
||||
appInitialInstanceID <- (o .:? "instance-id") >>= maybe (return Nothing) (\v -> Just <$> ((Right <$> parseJSON v) <|> (Left <$> parseJSON v)))
|
||||
appInitialInstanceID <- runMaybeT $ do
|
||||
val <- MaybeT (o .:? "instance-id")
|
||||
val' <- lift $ (Right <$> parseJSON val) <|> (Left <$> parseJSON val)
|
||||
case val' of
|
||||
Left fp -> guard $ FilePath.isValid fp
|
||||
_ -> return ()
|
||||
return val'
|
||||
|
||||
return AppSettings {..}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user