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
|
|
|
}
|
2023-05-17 13:16:54 +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
|
|
|
, AppName : Text
|
|
|
|
, LiveMode : Bool
|
|
|
|
, DevelMode : Bool
|
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
|
|
|
}
|
2023-05-12 23:00:37 +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
|
|
|
}
|
2023-05-17 13:16:54 +02:00
|
|
|
, Mailer =
|
|
|
|
{ Enabled = False
|
|
|
|
, Protocol = "smtps"
|
|
|
|
, SMTPPort = 465
|
|
|
|
, ForceTrustServerCert = False
|
|
|
|
, EnableHELO = False
|
|
|
|
, SubjectPrefix = "pcmt - "
|
|
|
|
, SendPlainText = True
|
|
|
|
}
|
2023-05-06 01:24:31 +02:00
|
|
|
, AppName = "pcmt"
|
|
|
|
, LiveMode = False
|
|
|
|
, DevelMode = False
|
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
|
|
|
}
|
2023-05-12 23:00:37 +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
|