Snapshot of https://codeberg.org/notplants/tokio-experiments-archive-no2; full Git branches and tags, copied 2026-09-06.
README.md

Quickstart #

git clone https://codeberg.org/notplants/r-lichen.git
cd r-lichen
cargo run -- serve
# then visit http://localhost:8000/cms

Configuration #

r-lichen reads its runtime settings from layered sources:

  1. Built-in defaults (current working directory, content/, dist/).
  2. Optional settings.toml (pass --settings /path/to/file to any subcommand to point elsewhere; otherwise ./settings.toml is loaded when present).
  3. Environment variables prefixed with LM_ (for example LM_CONTENT_DIR=/var/www/content).

Environment variables override file values, which override the defaults. All CLI subcommands (serve, build, export) accept the shared --settings flag so you can point the server and CLI tasks at the same configuration file.

All possible configurations are shown in settings.toml.example along with explanations.

A minimal settings.toml might look like:

base_dir = "/srv/lichen"
content_dir = "sites/site-a"      # relative paths resolve from base_dir
# dist_dir defaults to base_dir/dist if omitted

Each HTTP request has access to the resolved settings via application state, so future multi-tenant logic (e.g. swapping base_dir per authenticated user) can build on this foundation.

Authentication & User Management #

If settings.toml does not exist, or if use_auth is not explicitly set to true in settings.toml, then authentication will not be required.

If use_auth is set to true, then you need to create a user and password within settings.toml in order to login.

Users live in the [users] table inside settings.toml:

[users]
admin = "<argon2 hash>"

Use the built-in helpers to manage those entries without editing hashes by hand:

# adds a new user to settings.toml if they do not already exist
cargo run -- user add yourusername

# updates an existing password
cargo run -- user set-password yourusername

To start an authenticated session, visit /cms/login. After logging in via the form, the browser will have a cookie, manged by tower_sessions, which allows access to authenticated routes.