Running a site
Configuration
Settings are read in layers, each overriding the one before:
- built-in defaults;
gansey.tomlin the working directory, or the file--config(orGANSEY_CONFIG) names;- a
.envfile:./.env, or the fileGANSEY_ENV_FILEnames; - the process environment;
- command-line flags.
The .env file holds one NAME=value per line, and a variable already set in the real environment wins over it. Booleans accept true/false, yes/no, on/off and 1/0. An empty variable is ignored; a value that does not parse (a port that is not a number) stops the binary with an error naming the variable. gansey.example.toml and .env.example in the repository list every setting.
A few settings saved in the admin win over the file: the update channel, licence key and automatic patch installs (Updates), and the site name, hostname, language and the no-index switch (Settings → Site).
Server and site
| Key | Variable | Default | What it does |
|---|---|---|---|
[server].bind | GANSEY_BIND | 127.0.0.1 | address to listen on |
[server].port | GANSEY_PORT | 8080 | port to listen on |
[server].env | GANSEY_ENV | local | local, dev, staging or production |
[server].error_reporting | GANSEY_ERROR_REPORTING | follows env | include error detail in responses |
[server].admin_path | GANSEY_ADMIN_PATH | /admin | where the admin answers, such as /studio; see below |
[database].url | DATABASE_URL | none | Postgres URL; without one only the welcome page is served |
[site].name | GANSEY_SITE_NAME | Gansey site | name given to the site when its database is first set up |
[site].hostname | GANSEY_SITE_HOSTNAME | localhost | hostname given at first set-up, and the default sender domain for email |
After the first start, change the site's name and hostname in Settings → Site; the file values are only used to create the site.
Environments
env | Also accepted | Error detail | Indexable |
|---|---|---|---|
local | yes | no | |
dev | development | yes | no |
staging | stage, test | no | no |
production | prod, live | no | yes, unless switched off in Settings → Site |
An unknown value is treated as local, with a warning in the log.
Sign-in and email
| Key | Variable | Default | What it does |
|---|---|---|---|
[auth].public_url | GANSEY_PUBLIC_URL or GANSEY_URL | http://<bind>:<port> | the address visitors use |
[auth].session_days | GANSEY_SESSION_DAYS | 14 | how long a browser stays signed in |
[auth].secure_cookies | GANSEY_SECURE_COOKIES | on when public_url is https | mark the session cookie Secure |
[auth].members_home | GANSEY_MEMBERS_HOME | / | where members land after signing in on the public site |
[email].smtp_host | GANSEY_SMTP_HOST | none | an SMTP server; setting it switches email on |
[email].smtp_port | GANSEY_SMTP_PORT | 587 | its port |
[email].username | GANSEY_SMTP_USERNAME | none | its user name |
[email].password | GANSEY_SMTP_PASSWORD | none | its password |
[email].from | GANSEY_EMAIL_FROM | no-reply@<hostname> | sender address |
[email].implicit_tls | GANSEY_SMTP_IMPLICIT_TLS | false | TLS from the first byte instead of upgrading the connection |
Files, backups and logs
| Key | Variable | Default | What it does |
|---|---|---|---|
[media].root | GANSEY_MEDIA_ROOT | ./data/media | uploads and their sizes |
[backups].dir | GANSEY_BACKUP_DIR | ./data/backups | where backups go |
[backups].keep | GANSEY_BACKUP_KEEP | 14 | how many to keep |
[backups].nightly | GANSEY_BACKUP_NIGHTLY | true | take one every night |
[backups].hour | GANSEY_BACKUP_HOUR | 3 | hour of the nightly backup, UTC |
[logs].dir | GANSEY_LOG_DIR | ./data/logs | where log files go |
[logs].to_file | GANSEY_LOG_FILE | true | write JSON log files while serving |
[logs].keep_days | GANSEY_LOG_KEEP_DAYS | 14 | days of log files to keep; 0 keeps them all |
| (none) | RUST_LOG | info,gansey=debug,tower_http=info | which events are logged |
Updates, modules and signing
| Key | Variable | Default | What it does |
|---|---|---|---|
[updates].hub_url | GANSEY_HUB_URL | none | the hub this site updates from; unset turns updates off |
[updates].licence_key | GANSEY_LICENCE_KEY | none | GSY-XXXX-XXXX-XXXX-XXXX |
[updates].channel | GANSEY_UPDATE_CHANNEL | stable | stable, beta or nightly |
[updates].auto_patch | GANSEY_AUTO_PATCH | false | install patch releases on their own |
[updates].public_key | GANSEY_UPDATE_PUBLIC_KEY | pinned on first use | the hub's signing key, as hex |
[updates].check_interval_hours | GANSEY_UPDATE_CHECK_HOURS | 6 | hours between checks, at least 1 |
[updates].hosting_attest | GANSEY_HOSTING_ATTEST | none | set by our hosting only: where the site asks its server to vouch for it, unix:<socket path> |
[modules].dir | GANSEY_MODULES_DIR | ./data/modules | installed modules |
[modules].watch | GANSEY_MODULES_WATCH | true | reload a module when its files change |
[modules].files_dir | GANSEY_MODULE_FILES_DIR | module-files beside the media folder | files modules keep |
[modules].allow_unsigned | GANSEY_MODULES_ALLOW_UNSIGNED | true | let the admin install modules the hub has not signed (uploads, repositories, package URLs) |
[signing].key_file | GANSEY_SIGNING_KEY_FILE | none | the site's signing key file |
| (none) | GANSEY_SIGNING_KEY | none | the key itself, as hex or base64; wins over the file |