iocaine/docs/content/configuration.md
Gergely Nagy e8c9bc0056
docs: Sort the sections properly
How? -> Configuration -> Deploying

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-25 11:44:15 +01:00

2.5 KiB

title description weight
Configuration Configuring Iocaine 1

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.