leo
9eb811169d
All checks were successful
continuous-integration/drone/push Build is passing
this entails a couple of breaking changes due to schema evolution. once the schema is stabilised, backward compatibility promise will be given. * update config struct and accompanying scructs * update tests * update exampleConfig.dhall * update local dev environment (devenv) * make settings reflect the config schema changes * make use of some settings/config updates
37 lines
1.4 KiB
Haskell
37 lines
1.4 KiB
Haskell
{- import config schema that is integrity-check protected (with a fallback) -}
|
|
let ConfigSchema =
|
|
https://git.dotya.ml/mirre-mt/pcmt-config-schema/raw/tag/0.0.1-rc.2/package.dhall
|
|
sha256:9082079ea4d41cc290c879a6a7e2034a2914949c30c337975cc5c6fecfc0da50
|
|
? https://git.dotya.ml/mirre-mt/pcmt-config-schema/raw/tag/0.0.1-rc.2/package.dhall
|
|
|
|
let Config = ConfigSchema.Schema
|
|
|
|
let c =
|
|
{- below we allow overriding config values using env vars -}
|
|
Config::{
|
|
, Host = env:PCMT_HOST as Text ? Config.default.Host
|
|
, LiveMode = env:PCMT_LIVE ? True
|
|
, DevelMode = env:PCMT_DEVEL ? True
|
|
, Session =
|
|
Config.default.Session
|
|
// { CookieName = env:PCMT_SESSION_NAME as Text ? "pcmt_session"
|
|
, CookieAuthSecret =
|
|
env:PCMT_SESSION_AUTH_SECRET as Text
|
|
? Config.default.Session.CookieAuthSecret
|
|
, CookieEncrSecret =
|
|
env:PCMT_SESSION_ENCR_SECRET as Text
|
|
? Config.default.Session.CookieEncrSecret
|
|
}
|
|
, HTTP = Config.default.HTTP
|
|
, Mailer = Config.default.Mailer
|
|
, Init = Config.default.Init // { CreateAdmin = True }
|
|
}
|
|
|
|
let _ =
|
|
{- validate that the above adheres to the config schema and contains valid
|
|
entries (not everything gets validated though).
|
|
-}
|
|
assert : ConfigSchema.Schema/validate c
|
|
|
|
in c
|