Configuration
This guide is for whoever runs the server. It covers govwren.toml, environment overrides, the data home, PostgreSQL, running behind a reverse proxy, and the guard on demo installations.
What is configured where#
GovWren keeps two kinds of settings apart.
| Kind | Where it lives | Examples |
|---|---|---|
| How the server runs | govwren.toml and the environment | Address, port, database, data home |
| The program and the product's look | The database, set in the app or by a program pack | Forms, risk tiers, routing rules, vocabularies, name, logo, colors |
This guide is about the first. For the second, see Running the program.
The look is the one thing that can live in either place. Most organizations set it in the app. One that needs its brand reproduced exactly can fix it in the file: see [branding].
Where the file is found#
uv run govwren init writes a commented govwren.toml in the current directory. Every command looks for the file in this order:
- The
--config FILEoption (short form-c), given before the command. - The
GOVWREN_CONFIGenvironment variable. ./govwren.toml.
uv run govwren --config /etc/govwren/govwren.toml doctorRelative paths in the file are resolved against the file's own directory, not the directory you run from. An installation therefore moves as a unit.
Every section and key#
The file has five sections. A section or key that GovWren does not know is an error, not something it ignores. Every problem in the file is reported together.
[server]#
| Key | Default | Meaning |
|---|---|---|
host | "127.0.0.1" | The address the web server listens on. Keep 127.0.0.1 when a reverse proxy on the same machine terminates TLS. Use 0.0.0.0 only behind one |
port | 8000 | The port, from 1 to 65535 |
workers | 1 | How many server processes to run, from 1 to 64. One is enough for SQLite and small teams |
base_url | "" | The public address people use to reach GovWren, such as "https://govwren.example.org", with no path. Used for links in email and for the single sign-on redirect address. Set it once people reach GovWren at a stable address |
session_idle_hours | 12 | A sign-in ends after this long without activity. At least 1 |
session_max_days | 7 | A sign-in ends after this long in any case. At least 1 |
scheduler | true | Whether this server runs scheduled work: periodic reviews, lapsed approvals, reminders, and email. Set it to false only if you run govwren jobs run from a scheduled task. See What GovWren does by itself |
trusted_proxies | "127.0.0.1" | The proxies whose X-Forwarded-For and X-Forwarded-Proto are believed, separated by commas, or "*" for any. Leave it alone when the proxy is on the same machine. In a container the proxy is at another address: name it, or use "*" if only the proxy can reach GovWren. Either way, the proxy must replace X-Forwarded-For with the address it saw, not add to what the client sent: GovWren limits sign-in attempts by that address, and a client that can choose it can dodge the limit. The nginx and Caddy examples in deploy/ do this |
host, port, and workers can also be given to uv run govwren serve as --host, --port, and --workers, which take precedence for that run.
[database]#
| Key | Default | Meaning |
|---|---|---|
url | "" | Empty means SQLite, in the file govwren.db inside the data home. For PostgreSQL, an address beginning postgresql+psycopg://. See Use PostgreSQL |
[data]#
| Key | Default | Meaning |
|---|---|---|
home | "var" | The data home: the one directory that holds everything not in the database |
[sso]#
Single sign-on through an OpenID Connect provider. It is off until issuer and client_id are set. The keys are listed in Single sign-on.
[mail]#
Email over SMTP. It is off until host and from_address are set. The keys are listed in Email.
[registry]#
Off unless url is set. See Model details from your registry.
| Key | Default | Meaning |
|---|---|---|
url | "" | The address of a model registry to read from, once a day. It must begin https://. The model's registry name is added to it |
token_env | "GOVWREN_REGISTRY_TOKEN" | The name of the environment variable that holds the registry's token, if it needs one |
[assistant]#
Off, and invisible, until a model is named and GovWren knows where to ask it: with the openai provider, url and model both; with anthropic, a model; with bedrock, a model and a region. See An assistant inside GovWren before you set them. Ask GovWren also needs an administrator to turn it on under Admin → Assistant, which is stored with the program, not in this file.
| Key | Default | Meaning |
|---|---|---|
provider | "openai" | The protocol to speak: openai for any server that offers the chat completions interface, anthropic for Anthropic's Messages API, bedrock for Amazon Bedrock's Converse API |
url | "" | With openai, the API root, such as https://api.openai.com/v1. With anthropic or bedrock, leave it empty for the provider's own address, or give another server that speaks the same protocol. It must begin https://, unless it is on this machine |
model | "" | The model to ask: its name, or on Bedrock its model ID, inference profile ID, or ARN |
region | "" | With bedrock, the AWS region, such as us-west-2 |
key_env | "GOVWREN_ASSISTANT_KEY" | The name of the environment variable that holds the key, if the server needs one. Bedrock also reads AWS_BEARER_TOKEN_BEDROCK (a Bedrock API key), or AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN |
max_data_class | "internal" | The most sensitive class of data a request may involve and still be shown to the assistant |
max_tokens | 4000 | The longest answer, in tokens. Sent to Anthropic and Bedrock, which require one |
timeout_seconds | 60 | How long to wait for an answer |
temperature | not set | A sampling temperature, sent only if set. Many current models refuse one |
[branding]#
Optional. Leave it out and the look is set in the app, under Admin → Appearance, as before.
Use this section when the look has to be exact: every color by day and after dark, the official logo files, the brand's typefaces. It is also the way to keep a brand in version control, or to give several installations the same look.
What is set here wins over what the app stores, and shows under Admin → Appearance as locked, marked Set in the configuration file. Whatever this section leaves out can still be changed in the app. Nothing here is written to the database, so taking a line out gives that setting back to the app. A change takes effect when the server is restarted.
| Key | Meaning |
|---|---|
product_name | The name in the sidebar, the browser tab, and email. Up to 40 characters |
organization_name | Your organization's name, on the sign-in page |
show_powered_by | false to hide the small "Powered by GovWren" link |
logo_light, logo_dark | Image files for light and dark backgrounds. With no logo_dark, the light one is used for both |
favicon | The browser tab icon |
sign_in_image | The picture beside the sign-in form |
logo_height | The logo's height in the sidebar, in pixels, from 20 to 48. The usual is 30. Use it where a brand sets a least width for its logo |
font | The typeface for everything, as a list of font names in order of preference |
font_headings | A different typeface for page titles and section headings |
sign_in_message | A message on the sign-in page, up to 600 characters |
email_footer | The last line of every email |
footer_links | Up to five links, each { label = "…", url = "…" } |
terms | Your own words for GovWren's, as tables: [branding.terms.unit] with one = "Lab" and many = "Labs". The words that can be set are use_case, system, model, dataset, vendor, and unit |
palette | One of the built-in palettes: wren, slate, garnet |
accent, accent_dark | An accent color over a built-in palette, as hex. Not needed when [branding.colors] is set |
Image paths are relative to the file's folder. Images are PNG, JPEG, WebP, or SVG, up to 2 MB, and are served as they are: GovWren scales a logo and changes nothing else about it.
Fonts are named, never shipped. A name works on a computer that has the font installed, and the next name in the list is tried on one that does not, so end the list with fonts every computer has. A font that is licensed, as most brand typefaces are, cannot be put on the server for everyone.
Exact colors#
[branding.colors.day] and [branding.colors.night] replace the built-in palettes. Give both, or neither. Each color is a hex value.
| Color | What it is | If left out |
|---|---|---|
bg | The page behind everything | Needed |
surface | Cards, panels, and fields | Needed |
text | Ordinary text | Needed |
muted | Secondary text | Needed |
accent | Links, primary buttons, and the selected page | Needed |
on_accent | Text on a primary button | Black or white, whichever reads better |
stripe | The second color of the stripe across the top of the page | The accent |
border | Hairlines between things | A step from the surface |
border_strong, surface_2, surface_3, subtle, accent_hover, accent_soft | Finer shades: stronger lines, the sidebar and quieter panels, the faintest text, a button under the pointer, the background of a selected item | Worked out from the colors above, a step lighter or darker on the same hue |
[branding]
product_name = "Lantern"
organization_name = "Alderpoint Institute for Medical Research"
logo_light = "brand/alderpoint.svg"
logo_dark = "brand/alderpoint-white.svg"
favicon = "brand/alderpoint-icon.png"
font = ["Inter", "Arial"]
[branding.colors.day]
bg = "#f6f5f2"
surface = "#ffffff"
text = "#1d2733"
muted = "#57606b"
accent = "#1f5f8b"
[branding.colors.night]
bg = "#12171d"
surface = "#1a222b"
text = "#ffffff"
muted = "#b9c2cc"
accent = "#6cb6e6"
on_accent = "#0f1a24"GovWren refuses to start with colors that cannot be read. Text on the page and on a card, secondary text, the accent on a card, and text on the accent must each reach a contrast of 4.5 to 1, by day and after dark, and the message says which pair fell short and by how much. A brand color that is too pale for text on white, as a bright yellow or a light blue often is, belongs in stripe, not accent.
Three things are left alone, because they carry meaning: the colors for approved, warning, and refused; the colors of the four risk tiers; and the colors that tell kinds of record apart. When exact colors are set, people are no longer offered a palette of their own to choose, since there is nothing for it to change. Light and dark mode remain each person's choice.
To check a brand on every screen, run the accessibility audit with it: put the [branding] section in a file of its own, with full paths for its images, and name that file in GOVWREN_DEMO_BRANDING when you run node scripts/a11y-audit.mjs.
The file as written by init#
With its comments left out:
[server]
host = "127.0.0.1"
port = 8000
workers = 1
base_url = ""
session_idle_hours = 12
session_max_days = 7
scheduler = true
[database]
url = ""
[data]
home = "var"GovWren also gives advice that does not stop it running. serve and doctor warn when several workers share one SQLite file, and when base_url is http:// on a host other than localhost.
Environment overrides#
Any value can be overridden by an environment variable named GOVWREN_<SECTION>_<KEY>, in capitals. The environment wins over the file.
| Variable | Overrides |
|---|---|
GOVWREN_SERVER_HOST | [server] host |
GOVWREN_SERVER_PORT | [server] port |
GOVWREN_SERVER_WORKERS | [server] workers |
GOVWREN_SERVER_BASE_URL | [server] base_url |
GOVWREN_SERVER_SESSION_IDLE_HOURS | [server] session_idle_hours |
GOVWREN_SERVER_SESSION_MAX_DAYS | [server] session_max_days |
GOVWREN_SERVER_SCHEDULER | [server] scheduler |
GOVWREN_SERVER_TRUSTED_PROXIES | [server] trusted_proxies |
GOVWREN_REGISTRY_URL | [registry] url |
GOVWREN_ASSISTANT_PROVIDER, GOVWREN_ASSISTANT_URL, GOVWREN_ASSISTANT_MODEL, GOVWREN_ASSISTANT_REGION | [assistant] provider, url, model, and region |
GOVWREN_DATABASE_URL | [database] url |
GOVWREN_DATA_HOME | [data] home |
GOVWREN_SERVER_PORT=8080 uv run govwren serveNumbers are read from the variable's text, so 8080 works without quotes. GOVWREN_CONFIG is separate: it names the file itself.
Secrets are refused in the file#
govwren.toml is meant to be safe to read, copy, and keep under version control. GovWren refuses to start if the file holds a secret:
- A key named
password,secret,token,api_key, orkey, or ending in one of those after an underscore, is an error wherever it appears. - A database address with a password in it is an error when it is written in the file.
Put secrets in the environment instead. For the database, set the password in PGPASSWORD, or put the whole address, password and all, in GOVWREN_DATABASE_URL.
The data home#
The data home is created by init. With the default settings it is ./var.
| Path | Holds |
|---|---|
govwren.db | The SQLite database, when no database address is set |
brand/ | Uploaded logos and the tab icon |
logs/ | govwren.log, rotated at about 5 MB, with five older files kept |
files/ | Evidence files, each stored once under the SHA-256 of its content. Back this up with the database: the database says what each file is, and this directory holds it |
exports/ | Reserved for exports |
.govwren-home | A marker that says this directory is a data home |
- Back it up with
govwren backup, which takes the database and the files together. - Do not edit its contents by hand.
- It must be writable by the account that runs the server.
- Request bodies and form answers are never written to the log.
Use PostgreSQL#
SQLite is the default and needs no setup. Use PostgreSQL when many people will use GovWren at once or you want more than one server process. The features and the data model are the same on both.
- Install the driver, which is optional:
``bash
uv sync --extra postgres
``
- Create an empty database and a role that owns it, with your usual PostgreSQL tools.
- Set the address in
govwren.toml, without the password:
``toml
[database]
url = "postgresql+psycopg://govwren@db.example.org:5432/govwren"
``
- Put the password in the environment, then set up and check:
``bash
export PGPASSWORD='the database password'
uv run govwren init
uv run govwren doctor
``
init creates the schema, loads the default program, and creates the first administrator, exactly as it does on SQLite. doctor should report Database: PostgreSQL.
The address must begin postgresql+psycopg://. Other drivers and other databases are refused. The variable holding the password must be set for every govwren command and for the server.
When you update GovWren, apply schema changes before starting the server. serve refuses to start on a database whose schema is behind.
uv run govwren db current # where the database is, and what this version expects
uv run govwren db upgrade # apply what is missingRun behind a reverse proxy#
GovWren serves plain HTTP. For anything beyond your own machine, put a reverse proxy in front of it to terminate TLS.
- Keep
host = "127.0.0.1", so that only the proxy can reach GovWren. - Have the proxy forward every path to
http://127.0.0.1:8000. - Have the proxy pass these headers:
| Header | Why |
|---|---|
Host, or X-Forwarded-Host | GovWren refuses changes whose Origin does not match the host it was asked for. If the proxy rewrites Host, it must send the public name in X-Forwarded-Host |
X-Forwarded-Proto: https | So that the session cookie is marked Secure |
- Set
base_urlto the public address, such as"https://govwren.example.org".
What GovWren does itself, so the proxy need not:
- It sends a strict content security policy and related security headers on every response.
- It marks API responses
Cache-Control: no-store. - The session cookie is
HttpOnlyandSameSite=Strict. - It refuses changes that a browser marks as coming from another site.
For health checks, use GET /api/v1/health/live (the process is running) and GET /api/v1/health/ready (the database answers and its schema is current; it answers 503 when not). Neither needs a sign-in.
Sign-in is slowed after failures. Five wrong passwords for one account from one address stop that pair for fifteen minutes. One account from anywhere, and one address at any account, are stopped after thirty.
Deployment has ready-made files for a container, compose, systemd, Caddy, and nginx.
The demo and the network#
A demo organization offers sign-in as any of its sample people with no password. That is safe on your own machine and nowhere else, so two guards apply.
serverefuses to start a demo on any address other than127.0.0.1,localhost, or::1.- Passwordless sign-in is answered only for callers on the same machine.
To let a demo be reached from other machines, for example to show it to colleagues on a trusted network, say so explicitly:
uv run govwren --config demo/govwren.toml serve --host 0.0.0.0 --demo-on-network--demo-on-network lifts both guards for that run. Anyone who can reach the server can then sign in as any sample person, including its administrator. Do not use it on a network you do not trust, and do not publish a demo through a proxy: a proxy on the same machine can make every caller look local.
A demo is recognized by what is in its database, not by its directory. The guard does not apply to an ordinary installation, and nothing in an ordinary installation offers passwordless sign-in.
Check your settings#
uv run govwren doctordoctor reads the configuration the same way the server does, so it is the quickest way to find a mistake. It reports the file it used, any advice, the data home, the database and its schema, and whether the history verifies.