iocaine/docs/content/configuration.md
Gergely Nagy f5d4985f39
Move documentation to a dedicated site
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-25 01:31:38 +01:00

2.5 KiB

title description
Configuration Configuring Iocaine

iocaine can be configured via a TOML-format configuration file, or via the environment. Almost everything has sane defaults, but providing a wordlist, and at least one source for the markov generator is required.

The configuration file is split into three main sections: [server], [sources], and [generator].

[server]

The [server] section is used to configure the address and port the server will listen on, via the bind property. The default is shown below:

[server]
bind = "127.0.0.1:42069"

This parameter is available as IOCAINE_SERVER__BIND when configuring via environment variables.

[sources]

The [sources] section is the only section without defaults, specifying both options here is mandatory.

[sources]
words = "/usr/share/dict/wamerican.txt"
markov = ["/var/lib/iocaine/markov/bee-movie.txt", "/var/lib/iocaine/markov/moby-dick.txt"]

The first option, words, refers to a word list file, with one word per line. When generating links, the path of the link will be a word chosen from this word list.

The second option, markov, is a list of files used to train the markov chain generator. These will be used to generate the main content.

These parameters are available as IOCAINE_SOURCES__WORDS and IOCAINE_SOURCES__MARKOV, respectively, when configuring via environment variables. Do note that if configuring iocaine this way, the IOCAINE_SOURCES__MARKOV environment variable must be a TOML list: IOCAINE_SOURCES__MARKOV='["/var/lib/iocaine/markov/bee-movie.txt"]'.

[generator]

The [generator] section is used to describe how garbage is generated, how many paragraphs are produced per page, how many words they may have, how many links to place, and whether to add a "Back" link at the top. It looks like this, with defaults shown:

[generator.markov.paragraphs]
min = 1
max = 1

[generator.markov.words]
min = 10
max = 420

[generator.links]
min = 2
max = 5
backlink = true

[generator]
initial_seed = ""

When configuring through environment variables, these settings are available via IOCAINE_GENERATOR__MARKOV__PARAGRAPHS__MIN, IOCAINE_GENERATOR__MARKOV__PARAGRAPHS_MAX, IOCAINE_GENERATOR__MARKOV__WORDS__MIN, IOCAINE_GENERATOR__MARKOV__WORDS__MAX, IOCAINE_GENERATOR__LINKS__MIN, IOCAINE_GENERATOR__LINKS__MAX, and IOCAINE_GENERATOR__LINKS__BACKLINK, IOCAINE_GENERATOR__INITIAL_SEED respectively.