Golub is configured only with environment variables. They are all checked at startup; if one is wrong or missing, Golub exits and names the variable, for example:
GOLUB_SECRET_KEY: must decode to 32 bytes, got 9
Required
| Variable | Description |
|---|---|
GOLUB_IMAP_HOST | Host name of the IMAP server. Use the name on its certificate. |
GOLUB_SECRET_KEY | Key that encrypts session cookies: 32 random bytes, base64. Create it with openssl rand -base64 32. Changing it signs everyone out. |
Mail server
| Variable | Default | Description |
|---|---|---|
GOLUB_IMAP_TLS | starttls | implicit (TLS from the start), starttls or none. |
GOLUB_IMAP_PORT | 993 with implicit, otherwise 143 | |
GOLUB_SMTP_HOST | same as GOLUB_IMAP_HOST | Submission server for sending. |
GOLUB_SMTP_TLS | starttls | Same values as GOLUB_IMAP_TLS. |
GOLUB_SMTP_PORT | 465 with implicit, otherwise 587 | |
GOLUB_TLS_CA | Path to an extra CA bundle, for mail servers with a private certificate. |
none is only accepted when the host resolves to a loopback or private address, so passwords never cross the internet unencrypted. Certificates are always verified.
Golub saves a copy of every sent message to the Sent folder over IMAP.
Web server
| Variable | Default | Description |
|---|---|---|
GOLUB_LISTEN | :8080 | Address and port to listen on. |
GOLUB_TLS_CERT | Certificate file (PEM, full chain). Set together with GOLUB_TLS_KEY to serve HTTPS. | |
GOLUB_TLS_KEY | Private key file (PEM). | |
GOLUB_TRUST_PROXY | Comma-separated CIDRs of reverse proxies, like 127.0.0.1/32,172.16.0.0/12. Only these may set X-Forwarded-For and X-Forwarded-Proto. |
See Installation for both HTTPS setups.
Sessions
| Variable | Default | Description |
|---|---|---|
GOLUB_SESSION_TTL | 12h | How long a sign-in lasts, as a Go duration: 30m, 8h, 168h. |
The session lives only in an encrypted cookie. There is no session store on the server, so restarting Golub does not sign anyone out.
Single sign-on
| Variable | Default | Description |
|---|---|---|
GOLUB_SSO_SECRET | Shared secret for SSO tokens, at least 32 characters. Setting it turns SSO on. | |
GOLUB_MASTER_USER | Dovecot master user name. Required with SSO. | |
GOLUB_MASTER_PASSWORD | Dovecot master user password. Required with SSO. |
How it works and how to create tokens: Single sign-on.
Defaults for new users
| Variable | Default | Values |
|---|---|---|
GOLUB_DEFAULT_LOCALE | en | en, sr-Latn, ar |
GOLUB_DEFAULT_THEME | system | system, light, dark |
The language is picked in this order: the SSO token, the user's own choice, the browser's languages, then GOLUB_DEFAULT_LOCALE. Users can change both in Settings or on the login page.
Branding
| Variable | Default | Description |
|---|---|---|
GOLUB_BRAND_NAME | Golub | Name in the browser tab and on the login page, up to 64 characters. |
GOLUB_BRAND_LOGO | Path to a .png, .jpg, .svg or .webp file, up to 512 KB. | |
GOLUB_BRAND_ACCENT | Accent colour as #rrggbb, for example #2563eb. |
More in Branding.
Logging
| Variable | Default | Values |
|---|---|---|
GOLUB_LOG_LEVEL | info | debug, info, warn, error |
Logs are JSON lines on standard output.
Complete example
services:
golub:
image: ghcr.io/stefanpejcic/golub:0.3.0
restart: unless-stopped
read_only: true
ports:
- "127.0.0.1:8080:8080"
volumes:
- ./logo.svg:/etc/golub/logo.svg:ro
environment:
GOLUB_IMAP_HOST: mail.example.com
GOLUB_IMAP_TLS: implicit
GOLUB_SMTP_TLS: implicit
GOLUB_SECRET_KEY: ${GOLUB_SECRET_KEY} # in .env, created once with: openssl rand -base64 32
GOLUB_TRUST_PROXY: "127.0.0.1/32"
GOLUB_SESSION_TTL: 8h
GOLUB_DEFAULT_LOCALE: en
GOLUB_DEFAULT_THEME: system
GOLUB_BRAND_NAME: "Example Mail"
GOLUB_BRAND_LOGO: /etc/golub/logo.svg
GOLUB_BRAND_ACCENT: "#0f766e"



