Getting started

Configuration

Gansey reads its settings from five places. Later ones win:

  1. built-in defaults;
  2. gansey.toml: the file --config (or GANSEY_CONFIG) names, else ./gansey.toml when it exists;
  3. a .env file: the file GANSEY_ENV_FILE names, else ./.env when it exists;
  4. the real environment;
  5. command-line flags.

The .env file holds one NAME=value per line and is read into the environment at start-up. A variable already set in the real environment is left alone, which is how the environment beats the file. Quote values that contain spaces, such as GANSEY_SITE_NAME="Example Studio site". Empty values are ignored. A value that does not parse, such as a port that is not a number, stops the binary with an error that names the variable. In environment variables, booleans accept true/false, yes/no, on/off or 1/0.

A sensible split is to keep shared settings in gansey.toml and anything secret or per-machine (the database URL, SMTP password, licence key) in .env or the real environment. Copy gansey.example.toml and .env.example from the repository to start.

Flags

FlagCommandsSets
--config <path>allwhich gansey.toml to read
--bind <address>serve[server].bind
--port <n>, -pserve[server].port
--database-url <url>serve, migrate, doctor, user, backup and the other database commands[database].url
--migrateserverun migrations before serving

[server]

KeyVariableDefaultMeaning
bindGANSEY_BIND127.0.0.1address to listen on; 0.0.0.0 for all interfaces
portGANSEY_PORT8080port to listen on
envGANSEY_ENVlocallocal, dev, staging or production
error_reportingGANSEY_ERROR_REPORTINGfollows envinclude error detail in responses and error pages
admin_pathGANSEY_ADMIN_PATH/adminwhere the admin answers, such as /studio

See Environments and indexing for what env changes.

[database]

KeyVariableDefaultMeaning
urlDATABASE_URLnonePostgres URL, such as postgres://gansey:secret@localhost:5432/gansey; empty runs without a database

[site]

KeyVariableDefaultMeaning
nameGANSEY_SITE_NAMEGansey sitesite name
hostnameGANSEY_SITE_HOSTNAMElocalhostsite hostname

Both are used when the site's row is first created in the database. After that the stored values win; change them in the admin under Theme & settings → Site.

[auth]

KeyVariableDefaultMeaning
public_urlGANSEY_PUBLIC_URL or GANSEY_URLhttp://<bind>:<port>the site's public origin, used in emailed links and the sitemap line in robots.txt
session_daysGANSEY_SESSION_DAYS14how long a browser stays signed in
secure_cookiesGANSEY_SECURE_COOKIESon when public_url is httpsmark the session cookie Secure
members_homeGANSEY_MEMBERS_HOME/where members land after signing in on the public site

Behind a reverse proxy, set public_url to the address visitors use, such as https://example.test, or emailed links will point at the internal address.

[email]

Leave the section out and no email is sent; see Users and sign-in for what happens instead.

KeyVariableDefaultMeaning
smtp_hostGANSEY_SMTP_HOSTrequiredSMTP server
smtp_portGANSEY_SMTP_PORT587SMTP port
usernameGANSEY_SMTP_USERNAMEnoneSMTP user
passwordGANSEY_SMTP_PASSWORDnoneSMTP password
fromGANSEY_EMAIL_FROMrequired in the filesender, such as Example <[email protected]>
implicit_tlsGANSEY_SMTP_IMPLICIT_TLSfalsefalse upgrades the connection with STARTTLS; true uses TLS from the start (usually port 465)

GANSEY_SMTP_HOST on its own switches email on; the sender then defaults to no-reply@<hostname>.

[backups]

KeyVariableDefaultMeaning
dirGANSEY_BACKUP_DIR./data/backupswhere backups go
keepGANSEY_BACKUP_KEEP14how many to keep
nightlyGANSEY_BACKUP_NIGHTLYtruetake one every night
hourGANSEY_BACKUP_HOUR3the nightly hour, in UTC

[logs]

KeyVariableDefaultMeaning
dirGANSEY_LOG_DIR./data/logsfolder for log files
to_fileGANSEY_LOG_FILEtruealso write one JSON line per event to gansey.log.<date>
keep_daysGANSEY_LOG_KEEP_DAYS14delete daily files older than this

The console always gets readable lines; only gansey serve writes files. RUST_LOG sets how much is logged (default info,gansey=debug,tower_http=info).

[media]

KeyVariableDefaultMeaning
rootGANSEY_MEDIA_ROOT./data/mediauploads and their generated sizes

[updates]

KeyVariableDefaultMeaning
hub_urlGANSEY_HUB_URLnonethe hub this site updates from; unset turns updates off
licence_keyGANSEY_LICENCE_KEYnonelicence key, GSY-XXXX-XXXX-XXXX-XXXX
channelGANSEY_UPDATE_CHANNELstablestable, beta or nightly
auto_patchGANSEY_AUTO_PATCHfalseinstall x.y.Z patch releases automatically
public_keyGANSEY_UPDATE_PUBLIC_KEYpinned on first usehex key releases must be signed with
check_interval_hoursGANSEY_UPDATE_CHECK_HOURS6how often to check
hosting_attestGANSEY_HOSTING_ATTESTnoneset by our hosting only; leave it unset

The channel, licence key and auto-patch switch can also be set under Updates in the admin. Values saved there are stored in the database and win over the file.

[modules]

KeyVariableDefaultMeaning
dirGANSEY_MODULES_DIR./data/moduleswhere module packages live
watchGANSEY_MODULES_WATCHtruereload a module when its files change
files_dirGANSEY_MODULE_FILES_DIRmodule-files beside the media folderfiles modules store
allow_unsignedGANSEY_MODULES_ALLOW_UNSIGNEDtruelet Modules → Add your own install packages the hub has not signed; the command line always may

[signing]

KeyVariableDefaultMeaning
key_fileGANSEY_SIGNING_KEY_FILEnonethe site's ed25519 signing key, lent to modules allowed to sign files

GANSEY_SIGNING_KEY holds the key itself (hex or base64) and wins over the file. gansey signing-key new --out <file> makes one. Most sites never need it; see Publishing.