agate

Simple gemini server for static files
git clone https://github.com/mbrubeck/agate.git
Log | Files | Refs | README

commit e91c99ddab389b96a5bda3922d1c4cb19cc3fab0
parent 544f577b59c1a97336d110c87779dda3238b576e
Author: Johann150 <johann.galle@protonmail.com>
Date:   Wed, 10 Feb 2021 21:38:01 +0100

adjust configuration format info

also corrected some spelling mistakes

Diffstat:
MREADME.md | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md @@ -48,7 +48,7 @@ agate --content path/to/content/ \ All of the command-line arguments are optional. Run `agate --help` to see the default values used when arguments are omitted. -When a client requests the URL `gemini://example.com/foo/bar`, Agate will respond with the file at `path/to/content/foo/bar`. If any segment of the requested path starts with a dot, agate will respond with a status code 52, wether the file exists or not (this behaviour can be disabled with `--serve-secret`). If there is a directory at that path, Agate will look for a file named `index.gmi` inside that directory. +When a client requests the URL `gemini://example.com/foo/bar`, Agate will respond with the file at `path/to/content/foo/bar`. If any segment of the requested path starts with a dot, agate will respond with a status code 52, whether the file exists or not (this behaviour can be disabled with `--serve-secret`). If there is a directory at that path, Agate will look for a file named `index.gmi` inside that directory. ## Configuration @@ -58,15 +58,16 @@ Agate by default supports TLSv1.2 and TLSv1.3. You can disable support for TLSv1 ### Directory listing -You can enable a basic directory listing for a directory by putting a file called `.directory-listing-ok` in that directory. This does not have an effect on subdirectories. +You can enable a basic directory listing for a directory by putting a file called `.directory-listing-ok` in that directory. This does not have an effect on sub-directories. The directory listing will hide files and directories whose name starts with a dot (e.g. the `.directory-listing-ok` file itself or also the `.meta` configuration file). A file called `index.gmi` will always take precedence over a directory listing. ### Meta-Presets -You can put a file called `.meta` in a directory that stores some metadata about these files which Agate will use when serving these files. The file should be UTF-8 encoded. Like the `.directory-listing-ok` file, this file does not have an effect on subdirectories. -Lines starting with a `#` are comments and will be ignored like empty lines. All other lines must start with a file name (not a path), followed by a colon and then the metadata. +You can put a file called `.meta` in a directory. This file stores some metadata about these files which Agate will use when serving these files. The file should be UTF-8 encoded. Like the `.directory-listing-ok` file, this file does not have an effect on sub-directories. (*1) +This file is parsed as a YAML file and should contain a "hash" datatype with file names as the keys. This means: +Lines starting with a `#` are comments and will be ignored like empty lines. All other lines must start with a file name, followed by a colon and then the metadata. The metadata can take one of four possible forms: 1. empty @@ -74,7 +75,7 @@ The metadata can take one of four possible forms: 2. starting with a semicolon followed by MIME parameters Agate will append the specified string onto the MIME type, if the file is found. 3. starting with a gemini status code (i.e. a digit 1-6 inclusive followed by another digit) and a space - Agate will send the metadata wether the file exists or not. The file will not be sent or accessed. + Agate will send the metadata whether the file exists or not. The file will not be sent or accessed. 4. a MIME type, may include parameters Agate will use this MIME type instead of what it would guess, if the file is found. The default language parameter will not be used, even if it was specified on the command line. @@ -89,6 +90,8 @@ LICENSE:text/plain;charset=UTF-8 gone.gmi:52 This file is no longer here, sorry. ``` +(*1) It is *theoretically* possible to specify information on files which are in sub-directories. The problem would only be to make sure that this file is loaded before the respective path/file is requested. This is because Agate does not actively check that the "no sub-directories" regulation is met. In fact this might be dropped in a change of configuration format in the foreseeable future. + ### Logging Verbosity Agate uses the `env_logger` crate and allows you to set the logging verbosity by setting the default `RUST_LOG` environment variable. For more information, please see the [documentation of `env_logger`].