From f778ff745549d46faae43f96af9ff46cf7472965 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 23 May 2023 22:42:07 +0200 Subject: [PATCH] tex: add full schema with defaults --- tex/text.tex | 87 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 4 deletions(-) diff --git a/tex/text.tex b/tex/text.tex index 4434060..b17d099 100644 --- a/tex/text.tex +++ b/tex/text.tex @@ -603,7 +603,16 @@ configuration language. The configuration schema was at first being developed as part of the main project's repository, before it was determined that it would benefit both the development and overall clarity if the schema lived in its own repository (see -Section~\ref{sec:repos} for details). +Section~\ref{sec:repos} for details). This enabled it to be independently +developed and versioned and only pulled into the main application whenever it +is determined the application is ready for it. + +The full schema with type annotations can be seen in +Figure~\ref{fig:dhallschema}. The \texttt{let} statement declares a variable +called \texttt{Schema} and assigns it the result of the expression on the right +side of the equals sign, which has for practical reasons been trimmed and is +displayed without the \emph{default} block, which is instead shown in its own +Figure~\ref{fig:dhallschemadefault}. \begin{figure}[h] \begin{varwidth} @@ -653,14 +662,84 @@ Section~\ref{sec:repos} for details). , Init : { CreateAdmin : Bool, AdminPassword : Text } , Registration : { Allowed : Bool } } - , default = {=} + } + \end{verbatim} + \end{varwidth} + \caption{Dhall configuration schema version 0.0.1-rc.2} + \label{fig:dhallschema} +\end{figure} +\newpage +\begin{figure}[!h] + \begin{varwidth} + \scriptsize + \begin{verbatim} + , default = + -- | have sane defaults. + { Host = "" + , Port = 3000 + , HTTP = + { Domain = "" + , Secure = False + , AutoTLS = False + , TLSKeyPath = "" + , TLSCertKeyPath = "" + , HSTSMaxAge = 0 + , ContentSecurityPolicy = "" + , RateLimit = 0 + , Gzip = 0 + , Timeout = 0 + } + , Mailer = + { Enabled = False + , Protocol = "smtps" + , SMTPAddr = "" + , SMTPPort = 465 + , ForceTrustServerCert = False + , EnableHELO = False + , HELOHostname = "" + , Auth = "" + , From = "" + , User = "" + , Password = "" + , 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 = "" + , CookieEncrSecret = "" + , MaxAge = 3600 + } + , Logger = { JSON = True, Fmt = None Text } + , 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 + } } in Schema \end{verbatim} \end{varwidth} - \caption{Dhall configuration schema version 0.0.1-rc.1} - \label{fig:dhallschema} + \caption{Dhall configuration defaults for schema version 0.0.1-rc.2} + \label{fig:dhallschemadefaults} \end{figure}