Running a site

Configuration

Settings are read in layers, each overriding the one before:

  1. built-in defaults;
  2. gansey.toml in the working directory, or the file --config (or GANSEY_CONFIG) names;
  3. a .env file: ./.env, or the file GANSEY_ENV_FILE names;
  4. the process environment;
  5. 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

KeyVariableDefaultWhat it does
[server].bindGANSEY_BIND127.0.0.1address to listen on
[server].portGANSEY_PORT8080port to listen on
[server].envGANSEY_ENVlocallocal, dev, staging or production
[server].error_reportingGANSEY_ERROR_REPORTINGfollows envinclude error detail in responses
[server].admin_pathGANSEY_ADMIN_PATH/adminwhere the admin answers, such as /studio; see below
[database].urlDATABASE_URLnonePostgres URL; without one only the welcome page is served
[site].nameGANSEY_SITE_NAMEGansey sitename given to the site when its database is first set up
[site].hostnameGANSEY_SITE_HOSTNAMElocalhosthostname 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

envAlso acceptedError detailIndexable
localyesno
devdevelopmentyesno
stagingstage, testnono
productionprod, livenoyes, unless switched off in Settings → Site

An unknown value is treated as local, with a warning in the log.

Sign-in and email

KeyVariableDefaultWhat it does
[auth].public_urlGANSEY_PUBLIC_URL or GANSEY_URLhttp://<bind>:<port>the address visitors use
[auth].session_daysGANSEY_SESSION_DAYS14how long a browser stays signed in
[auth].secure_cookiesGANSEY_SECURE_COOKIESon when public_url is httpsmark the session cookie Secure
[auth].members_homeGANSEY_MEMBERS_HOME/where members land after signing in on the public site
[email].smtp_hostGANSEY_SMTP_HOSTnonean SMTP server; setting it switches email on
[email].smtp_portGANSEY_SMTP_PORT587its port
[email].usernameGANSEY_SMTP_USERNAMEnoneits user name
[email].passwordGANSEY_SMTP_PASSWORDnoneits password
[email].fromGANSEY_EMAIL_FROMno-reply@<hostname>sender address
[email].implicit_tlsGANSEY_SMTP_IMPLICIT_TLSfalseTLS from the first byte instead of upgrading the connection

Files, backups and logs

KeyVariableDefaultWhat it does
[media].rootGANSEY_MEDIA_ROOT./data/mediauploads and their sizes
[backups].dirGANSEY_BACKUP_DIR./data/backupswhere backups go
[backups].keepGANSEY_BACKUP_KEEP14how many to keep
[backups].nightlyGANSEY_BACKUP_NIGHTLYtruetake one every night
[backups].hourGANSEY_BACKUP_HOUR3hour of the nightly backup, UTC
[logs].dirGANSEY_LOG_DIR./data/logswhere log files go
[logs].to_fileGANSEY_LOG_FILEtruewrite JSON log files while serving
[logs].keep_daysGANSEY_LOG_KEEP_DAYS14days of log files to keep; 0 keeps them all
(none)RUST_LOGinfo,gansey=debug,tower_http=infowhich events are logged

Updates, modules and signing

KeyVariableDefaultWhat it does
[updates].hub_urlGANSEY_HUB_URLnonethe hub this site updates from; unset turns updates off
[updates].licence_keyGANSEY_LICENCE_KEYnoneGSY-XXXX-XXXX-XXXX-XXXX
[updates].channelGANSEY_UPDATE_CHANNELstablestable, beta or nightly
[updates].auto_patchGANSEY_AUTO_PATCHfalseinstall patch releases on their own
[updates].public_keyGANSEY_UPDATE_PUBLIC_KEYpinned on first usethe hub's signing key, as hex
[updates].check_interval_hoursGANSEY_UPDATE_CHECK_HOURS6hours between checks, at least 1
[updates].hosting_attestGANSEY_HOSTING_ATTESTnoneset by our hosting only: where the site asks its server to vouch for it, unix:<socket path>
[modules].dirGANSEY_MODULES_DIR./data/modulesinstalled modules
[modules].watchGANSEY_MODULES_WATCHtruereload a module when its files change
[modules].files_dirGANSEY_MODULE_FILES_DIRmodule-files beside the media folderfiles modules keep
[modules].allow_unsignedGANSEY_MODULES_ALLOW_UNSIGNEDtruelet the admin install modules the hub has not signed (uploads, repositories, package URLs)
[signing].key_fileGANSEY_SIGNING_KEY_FILEnonethe site's signing key file
(none)GANSEY_SIGNING_KEYnonethe key itself, as hex or base64; wins over the file