pcmt-config-schema/schema.dhall

109 lines
3.5 KiB
Haskell
Raw Normal View History

2023-05-06 01:24:31 +02:00
let Schema =
-- | define a configuration schema.
{ Type =
{ Host : Text
, Port : Natural
2023-05-13 21:59:35 +02:00
, HTTP :
{ Domain : Text
, Secure : Bool
, AutoTLS : Bool
, TLSKeyPath : Text
, TLSCertKeyPath : Text
, HSTSMaxAge : Natural
, ContentSecurityPolicy : Text
2023-05-15 13:54:25 +02:00
, RateLimit : Natural
, Gzip : Natural
2023-05-17 12:36:49 +02:00
, Timeout : Natural
2023-05-13 21:59:35 +02:00
}
, Mailer :
{ Enabled : Bool
, Protocol : Text
, SMTPAddr : Text
, SMTPPort : Natural
, ForceTrustServerCert : Bool
, EnableHELO : Bool
, HELOHostname : Text
, Auth : Text
, From : Text
, User : Text
, Password : Text
, SubjectPrefix : Text
, SendPlainText : Bool
}
2023-05-06 01:24:31 +02:00
, LiveMode : Bool
, DevelMode : Bool
2023-05-17 20:14:42 +02:00
, AppPath : Text
2023-05-13 21:49:50 +02:00
, Session :
{ CookieName : Text
, CookieAuthSecret : Text
, CookieEncrSecret : Text
2023-05-13 22:03:57 +02:00
, MaxAge : Natural
2023-05-13 21:49:50 +02:00
}
, Logger : { JSON : Bool, Fmt : Optional Text }
2023-05-17 19:59:38 +02:00
, Init : { CreateAdmin : Bool, AdminPassword : Text }
2023-05-06 01:24:31 +02:00
, Registration : { Allowed : Bool }
}
, default =
-- | have sane defaults.
{ Host = ""
, Port = 3000
2023-05-13 21:59:35 +02:00
, HTTP =
{ Domain = ""
, Secure = False
, AutoTLS = False
, TLSKeyPath = ""
, TLSCertKeyPath = ""
, HSTSMaxAge = 0
, ContentSecurityPolicy = ""
2023-05-15 13:54:25 +02:00
, RateLimit = 0
, Gzip = 0
2023-05-17 12:36:49 +02:00
, Timeout = 0
2023-05-13 21:59:35 +02:00
}
, Mailer =
{ Enabled = False
, Protocol = "smtps"
2023-05-21 00:39:40 +02:00
, SMTPAddr = ""
, SMTPPort = 465
, ForceTrustServerCert = False
, EnableHELO = False
2023-05-21 00:39:40 +02:00
, HELOHostname = ""
, Auth = ""
, From = ""
, User = ""
, Password = ""
, SubjectPrefix = "pcmt - "
, SendPlainText = True
}
2023-05-17 20:10:12 +02:00
, LiveMode =
-- | LiveMode controls whether the application looks for
-- | directories "assets" and "templates" on the filesystem or
-- | in its bundled Embed.FS.
False
2023-05-06 01:24:31 +02:00
, DevelMode = False
2023-05-17 20:14:42 +02:00
, AppPath =
-- | AppPath specifies where the program looks for "assets" and
-- | "templates" in case LiveMode is True.
"."
2023-05-13 21:49:50 +02:00
, Session =
{ CookieName = "pcmt_session"
, CookieAuthSecret = ""
, CookieEncrSecret = ""
2023-05-13 22:03:57 +02:00
, MaxAge = 3600
2023-05-13 21:49:50 +02:00
}
, Logger = { JSON = True, Fmt = None Text }
2023-05-17 19:59:38 +02:00
, Init =
{ CreateAdmin =
-- | if this is True, attempt to create a user with admin
-- | privileges with the password specified below (or better -
-- | overriden); it fails if users already exist in the DB.
False
, AdminPassword =
-- | used for the first admin, forced change on first login.
"50ce50fd0e4f5894d74c4caecb450b00c594681d9397de98ffc0c76af5cff5953eb795f7"
}
2023-05-06 01:24:31 +02:00
, Registration.Allowed = True
}
}
in Schema