Cleanup for documentation

This commit is contained in:
Gregor Kleen 2018-12-14 21:39:43 +01:00
parent c6918affd5
commit c21b645446
6 changed files with 28 additions and 6 deletions

View File

@ -49,6 +49,8 @@ stanzas:
- SMTPPASS - SMTPPASS
- SMTPTIMEOUT - SMTPTIMEOUT
- SMTPLIMIT - SMTPLIMIT
- MAILSUPPORT
- MAILSUPPORT_NAME
- INSTANCE_ID - INSTANCE_ID
- MEMCACHEDHOST - MEMCACHEDHOST
- MEMCACHEDPORT - MEMCACHEDPORT

View File

@ -48,6 +48,8 @@ stanzas:
- SMTPPASS - SMTPPASS
- SMTPTIMEOUT - SMTPTIMEOUT
- SMTPLIMIT - SMTPLIMIT
- MAILSUPPORT
- MAILSUPPORT_NAME
- INSTANCE_ID - INSTANCE_ID
- MEMCACHEDHOST - MEMCACHEDHOST
- MEMCACHEDPORT - MEMCACHEDPORT

View File

@ -16,8 +16,8 @@ mail-verp:
separator: "+" separator: "+"
at-replacement: "=" at-replacement: "="
mail-support: mail-support:
name: null name: "_env:MAILSUPPORT_NAME:"
email: "uni2work@ifi.lmu.de" email: "_env:MAILSUPPORT:uni2work@ifi.lmu.de"
job-workers: "_env:JOB_WORKERS:10" job-workers: "_env:JOB_WORKERS:10"
job-flush-interval: "_env:JOB_FLUSH:30" job-flush-interval: "_env:JOB_FLUSH:30"

View File

@ -12,6 +12,8 @@ import Data.Aeson
import Data.Aeson.TH import Data.Aeson.TH
import Utils.PathPiece import Utils.PathPiece
import Utils (assertM)
deriving instance Read Address deriving instance Read Address
@ -20,6 +22,12 @@ deriving instance Generic Address
instance Hashable Address instance Hashable Address
deriveJSON defaultOptions deriveToJSON defaultOptions
{ fieldLabelModifier = intercalate "-" . map toLower . drop 1 . splitCamel { fieldLabelModifier = intercalate "-" . map toLower . drop 1 . splitCamel
} ''Address } ''Address
instance FromJSON Address where
parseJSON = withObject "Address" $ \obj -> do
addressName <- assertM (not . null) <$> (obj .:? "name")
addressEmail <- obj .: "email"
return Address{..}

View File

@ -59,11 +59,15 @@ import qualified Database.Memcached.Binary.Types as Memcached
import Model import Model
import Settings.Cluster 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 -- | Runtime settings to configure this application. These settings can be
-- loaded from various sources: defaults, environment variables, config files, -- loaded from various sources: defaults, environment variables, config files,
-- theoretically even a database. -- theoretically even a database.
data AppSettings = AppSettings data AppSettings = AppSettings
{ appStaticDir :: String { appStaticDir :: FilePath
-- ^ Directory from which to serve static files. -- ^ Directory from which to serve static files.
, appDatabaseConf :: PostgresConf , appDatabaseConf :: PostgresConf
-- ^ Configuration settings for accessing the database. -- ^ Configuration settings for accessing the database.
@ -360,7 +364,13 @@ instance FromJSON AppSettings where
appUserDefaults <- o .: "user-defaults" appUserDefaults <- o .: "user-defaults"
appAuthPWHash <- o .: "auth-pw-hash" 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 {..} return AppSettings {..}

View File

@ -7,7 +7,7 @@ in haskell.lib.buildStackProject {
inherit ghc; inherit ghc;
name = "stackenv"; name = "stackenv";
buildInputs = (with pkgs; buildInputs = (with pkgs;
[ postgresql zlib openldap cyrus_sasl.dev libsodium [ postgresql zlib libsodium
]) ++ (with haskellPackages; ]) ++ (with haskellPackages;
[ yesod-bin [ yesod-bin
]); ]);