Compare commits

...

9 Commits

Author SHA1 Message Date
leo 9b44edb5a5
release version 0.0.1-rc.1 2023-05-20 21:37:55 +02:00
leo 4ab5599784
schema: add AppPath attr 2023-05-17 20:14:42 +02:00
leo 0ab0975ad5
schema: explain LiveMode 2023-05-17 20:10:12 +02:00
leo 063bbe9f16
schema: rm AppName attr 2023-05-17 20:07:22 +02:00
leo 8549e0188d
schema: add Init record 2023-05-17 19:59:38 +02:00
leo 2eef5a1328
schema,validation: add mailer record+defaults 2023-05-17 13:16:54 +02:00
leo b61e07b57c
schema: add HTTP struct attr Timeout 2023-05-17 12:36:49 +02:00
leo 0e5761216a
schema: add HTTP attrs RateLimit, Gzip 2023-05-15 13:54:25 +02:00
leo bd1223a731
release version 0.0.1-rc.0 2023-05-13 22:06:21 +02:00
5 changed files with 65 additions and 14 deletions

View File

@ -1 +1 @@
0.0.0
0.0.1-rc.1

View File

@ -1,14 +1,14 @@
{ Schema =
./schema.dhall
sha256:2e7490953649881f93eec24109ef7a93738ab8fab8ccf40c33260af7faf413a5
sha256:3f615a66aa32fc6c61a7ecfa42b809efcd42acbccf55ed7b0067bd11636debb2
? ./schema.dhall
, Schema/validate =
./validate.dhall
sha256:8d309832e89fab8babec5b1fef692f1bd6db5974befe8c4fbdbaac6b4e9c1619
sha256:b549161c382eab83cc2c0063bd0ac0472b51b78687e4aa36f686244cf4a0a1b1
? ./validate.dhall
, Schema/version =
./version.dhall
sha256:0f11c01e7e2c9a4532211f599115b64c5830e2478475605766278a08f86161ee
sha256:29f94d910d58af54d187e6bcbc7dcfe7f67513c8bd4463d0856fa532783b3c1e
? ./version.dhall
, Prelude =
./prelude.dhall

View File

@ -11,10 +11,28 @@ let Schema =
, TLSCertKeyPath : Text
, HSTSMaxAge : Natural
, ContentSecurityPolicy : Text
, RateLimit : Natural
, Gzip : Natural
, Timeout : Natural
}
, 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
}
, AppName : Text
, LiveMode : Bool
, DevelMode : Bool
, AppPath : Text
, Session :
{ CookieName : Text
, CookieAuthSecret : Text
@ -22,7 +40,7 @@ let Schema =
, MaxAge : Natural
}
, Logger : { JSON : Bool, Fmt : Optional Text }
, InitialAdminPassword : Text
, Init : { CreateAdmin : Bool, AdminPassword : Text }
, Registration : { Allowed : Bool }
}
, default =
@ -37,10 +55,29 @@ let Schema =
, TLSCertKeyPath = ""
, HSTSMaxAge = 0
, ContentSecurityPolicy = ""
, RateLimit = 0
, Gzip = 0
, Timeout = 0
}
, AppName = "pcmt"
, LiveMode = False
, Mailer =
{ Enabled = False
, Protocol = "smtps"
, SMTPPort = 465
, ForceTrustServerCert = False
, EnableHELO = False
, SubjectPrefix = "pcmt - "
, SendPlainText = True
}
, LiveMode =
-- | LiveMode controls whether the application looks for
-- | directories "assets" and "templates" on the filesystem or
-- | in its bundled Embed.FS.
False
, DevelMode = False
, AppPath =
-- | AppPath specifies where the program looks for "assets" and
-- | "templates" in case LiveMode is True.
"."
, Session =
{ CookieName = "pcmt_session"
, CookieAuthSecret = ""
@ -48,9 +85,16 @@ let Schema =
, MaxAge = 3600
}
, Logger = { JSON = True, Fmt = None Text }
, InitialAdminPassword =
-- | used for the first admin, forced change on first login.
"50ce50fd0e4f5894d74c4caecb450b00c594681d9397de98ffc0c76af5cff5953eb795f7"
, 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"
}
, Registration.Allowed = True
}
}

View File

@ -5,7 +5,7 @@ let Prelude =
let Schema =
./schema.dhall
sha256:2e7490953649881f93eec24109ef7a93738ab8fab8ccf40c33260af7faf413a5
sha256:3f615a66aa32fc6c61a7ecfa42b809efcd42acbccf55ed7b0067bd11636debb2
? ./schema.dhall
let Schema/validate
@ -13,13 +13,20 @@ let Schema/validate
=
-- | define validation.
\(c : Schema.Type) ->
let expected = { validPort = True }
let expected = { validPort = True, validSMTPPort = True }
let actual =
{ validPort =
-- | make sure port number belongs to the <1;65535> range.
Prelude.Natural.lessThanEqual 1 c.Port
&& Prelude.Natural.lessThanEqual c.Port 65535
, validSMTPPort =
if c.Mailer.Enabled == False
then True
else Prelude.Natural.lessThanEqual 1 c.Mailer.SMTPPort
&& Prelude.Natural.lessThanEqual
c.Mailer.SMTPPort
65535
}
in expected === actual

View File

@ -1 +1 @@
let version = "0.0.0" in version
let version = "0.0.1-rc.1" in version