commit 8b743ddacb8cac52c0125917c80790073bffd343 from: Omar Polo date: Tue Jun 29 14:19:35 2021 UTC document macros: both -D and syntax commit - 6b86655a10753eae668e839207692d9d43138679 commit + 8b743ddacb8cac52c0125917c80790073bffd343 blob - 2ffaecde16bfa7dbea1300e50310b8344e54738b blob + 00b37d0dd2efd91273b5b65b491bc97ff9eeb01d --- gmid.1 +++ gmid.1 @@ -22,6 +22,7 @@ .Bk -words .Op Fl fnv .Op Fl c Ar config +.Op Fl D Ar macro Ns = Ns Ar value .Op Fl P Ar pidfile .Ek .Nm @@ -48,6 +49,15 @@ The options are as follows: .Bl -tag -width 14m .It Fl c Pa config Specify the configuration file. +.It Fl D Ar macro Ns = Ns Ar value +Define +.Ar macro +to be set to +.Ar value +on the command line. +Overrides the definition of +.Ar macro +in the config file if present. .It Fl f Stays and logs on the foreground. .It Fl n @@ -112,8 +122,11 @@ The root directory to serve. By default the current working directory is assumed. .El .Sh CONFIGURATION FILE -The configuration file is divided into two sections: +The configuration file is divided into three sections: .Bl -tag -width xxxx +.It Sy Macros +User-defined variables may be defined and used later, simplifying the +configuration file. .It Sy Global Options Global settings for .Nm . @@ -131,6 +144,32 @@ or .Sq off . A string is a sequence of characters wrapped in double quotes, .Dq like this . +.Pp +Strict ordering of the sections is not enforced, so that is possible +to mix macros, options and +.Ic server +blocks. +However, defining all the +.Ic server +blocks after the macros and the global options is recommended. +.Ss Macros +Macros can be defined that will later be expanded in context. +Macro names must start with a letter, digit or underscore and may +contain any of those characters. +Macro names may not be reserved words. +Macros are expanded inside the quotes too. +.Pp +For example: +.Bd -literal -offset indent +dir = "/var/gemini" +cert = "/etc/keys" + +server "foo" { + root "$dir/foo" # -> /var/gemini/foo + cert "$cert/foo.crt" # -> /etc/keys/foo.crt + key "$cert/foo.pem" # -> /etc/keys/foo.pem +} +.Ed .Ss Global Options .Bl -tag -width 12m .It Ic chroot Pa path