2023-05-05 19:31:43 +02:00
|
|
|
{- import config schema that is integrity-check protected (with a fallback) -}
|
2023-05-04 21:40:25 +02:00
|
|
|
let ConfigSchema =
|
2023-05-06 01:48:03 +02:00
|
|
|
https://git.dotya.ml/mirre-mt/pcmt-config-schema/raw/tag/0.0.0/package.dhall
|
2023-05-05 19:31:43 +02:00
|
|
|
sha256:c82b0904c261d442e5765c2f47d76ad53c3c3ed16ace1b33416cedf98f2f5df0
|
2023-05-06 01:48:03 +02:00
|
|
|
? https://git.dotya.ml/mirre-mt/pcmt-config-schema/raw/tag/0.0.0/package.dhall
|
2023-05-04 21:40:25 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|