Files
server/gotify-server.env.example
JT 09f5f0ba34 feat: limit request body size
Wrap every request body in http.MaxBytesReader so oversized bodies are
cut off before they are read completely. The limit defaults to 10 MiB
and can be changed with GOTIFY_SERVER_MAX_BODY_BYTES (0 disables it).
2026-10-12 15:41:05 -04:00

348 lines
11 KiB
Plaintext

# Example environment variables for the server.
# Save as `gotify-server.env` (or export the variables) when edited.
#
# If $GOTIFY_CONFIG_FILE is set, that file is loaded exclusively and none of
# the files below are tried. Otherwise the first existing file from the search
# order is loaded. Absent or commented out settings fall back to the default
# (shown after the =). Variables already exported in the process environment
# always take precedence over the loaded file.
#
# Config file search order (used only when $GOTIFY_CONFIG_FILE is unset):
# 1. gotify-server.env (in the working directory)
# 2. $XDG_CONFIG_HOME/gotify/gotify-server.env
# ($XDG_CONFIG_HOME falls back to $HOME/.config when unset)
# 3. /etc/gotify/server.env
#
# Value types used below:
# text a plain string value.
# number an integer value.
# boolean `true` or `false`.
# text-list comma-separated list of strings, parsed as a single CSV line.
# A comma can be escaped by wrapping the value in quotes.
# Example: a,b,c
# Example: "a,b",c -> entries: `a,b` and `c`
# json-map a JSON object mapping string keys to string values.
# Example: {"X-Foo":"bar","X-Baz":"qux"}
#
# Every variable also supports a "_FILE" suffix that reads the value from a
# file at the given path (useful for Docker / Kubernetes secrets), e.g.:
# GOTIFY_DEFAULTUSER_PASS_FILE=/run/secrets/admin_pass
# Minimum severity of log messages to emit.
# Values: trace, debug, info, warn, error, fatal, panic
# GOTIFY_LOGLEVEL=info
# Interval in seconds between TCP keepalive probes on accepted connections. !! Only change this if you know what you are doing.
#
# Example: 0 uses the Go default (15s)
# Example: -1 disables keepalives entirely.
# Type: number
# GOTIFY_SERVER_KEEPALIVEPERIODSECONDS=0
# The network address the HTTP server binds to. Leave empty to listen on all
# interfaces (both IPv4 and IPv6). Prefix with "unix:" to listen on a Unix
# domain socket instead of a TCP port.
#
# Type: text
# Example: 192.168.178.2
# Example: unix:/tmp/gotify.sock
# GOTIFY_SERVER_LISTENADDR=
# Port the HTTP server listens on.
# Type: number
# GOTIFY_SERVER_PORT=80
# Enable the HTTPS listener. Requires either CERTFILE+CERTKEY or LETSENCRYPT_ENABLED=true.
# Type: boolean
# GOTIFY_SERVER_SSL_ENABLED=false
# Redirect plain HTTP requests to HTTPS. Only effective when SSL_ENABLED=true.
# Type: boolean
# GOTIFY_SERVER_SSL_REDIRECTTOHTTPS=true
# The network address the HTTPS server binds to. Leave empty to listen on all
# interfaces (both IPv4 and IPv6). Prefix with "unix:" to listen on a Unix
# domain socket instead of a TCP port.
#
# Type: text
# Example: 192.168.178.2
# Example: unix:/tmp/gotify-ssl.sock
# GOTIFY_SERVER_SSL_LISTENADDR=
# Port the HTTPS server listens on.
# Type: number
# GOTIFY_SERVER_SSL_PORT=443
# Path to the TLS certificate.
# Type: text
# Example: /etc/ssl/certs/gotify.crt
# GOTIFY_SERVER_SSL_CERTFILE=
# Path to the TLS private key.
# Type: text
# Example: /etc/ssl/private/gotify.key
# GOTIFY_SERVER_SSL_CERTKEY=
# Obtain the TLS certificate automatically from Let's Encrypt.
# Requires SSL_ENABLED=true and LETSENCRYPT_ACCEPTTOS=true.
# Type: boolean
# GOTIFY_SERVER_SSL_LETSENCRYPT_ENABLED=false
# Accept the Let's Encrypt Terms of Service.
# Type: boolean
# GOTIFY_SERVER_SSL_LETSENCRYPT_ACCEPTTOS=false
# Directory where issued certificates and ACME account data are persisted. Must
# be writable by the server.
#
# Type: text
# Example: /var/lib/gotify/certs
# GOTIFY_SERVER_SSL_LETSENCRYPT_CACHE=data/certs
# Override the ACME directory URL. Leave empty to use the Let's Encrypt
# production server. The staging server has higher rate limits useful for
# testing but issues certificates that are not publicly trusted.
#
# Type: text
# Example: https://acme-staging-v02.api.letsencrypt.org/directory
# GOTIFY_SERVER_SSL_LETSENCRYPT_DIRECTORYURL=
# Hosts Let's Encrypt should issue certificates for. Each host must resolve
# publicly to this server.
#
# Type: text-list
# Example: mydomain.tld,myotherdomain.tld
# GOTIFY_SERVER_SSL_LETSENCRYPT_HOSTS=
# Extra HTTP headers attached to every response.
# Type: json-map
# Example: {"X-Custom-Header":"custom value"}
# GOTIFY_SERVER_RESPONSEHEADERS=
# IPs or CIDR ranges of proxies whose X-Forwarded-For header is trusted to
# determine the real client IP. Include 127.0.0.1 when terminating TLS in a
# sidecar on the same host.
#
# Type: text-list
# Example: 127.0.0.1/32,::1
# GOTIFY_SERVER_TRUSTEDPROXIES=
# Set the Secure flag on session cookies, restricting them to HTTPS
# connections. Enable when the server is reachable over HTTPS.
#
# Type: boolean
# GOTIFY_SERVER_SECURECOOKIE=false
# Maximum size in bytes of a request body. Requests with a larger body are
# rejected. Set to 0 to disable the limit.
#
# Type: number
# GOTIFY_SERVER_MAX_BODY_BYTES=10485760
# Allowed origins (regex) for cross-origin requests. Setting any CORS_* value
# enables CORS handling.
#
# Type: text-list
# Example: .+\.example\.com,otherdomain\.com
# GOTIFY_SERVER_CORS_ALLOWORIGINS=
# HTTP methods permitted in cross-origin requests.
# Type: text-list
# Example: GET,POST
# GOTIFY_SERVER_CORS_ALLOWMETHODS=
# Request headers permitted in cross-origin requests.
# Type: text-list
# Example: Authorization,content-type
# GOTIFY_SERVER_CORS_ALLOWHEADERS=
# Interval in seconds between WebSocket ping frames sent to streaming clients.
# Only change this if you know what you are doing.
#
# Type: number
# GOTIFY_SERVER_STREAM_PINGPERIODSECONDS=45
# Allowed origins (regex) for WebSocket upgrade requests. Same-origin
# connections are always permitted regardless of this setting.
#
# Type: text-list
# Example: .+\.example\.com,otherdomain\.com
# GOTIFY_SERVER_STREAM_ALLOWEDORIGINS=
# Enable authentication via username and password.
# Type: boolean
# GOTIFY_LOCALAUTH_ENABLED=true
# Enable OpenID Connect Single Sign-On, allowing users to authenticate via an
# external identity provider (e.g. Authelia, Dex, Keycloak). The provider must
# support PKCE (https://oauth.net/2/pkce/); IdPs without PKCE support are
# currently unsupported.
#
# Type: boolean
# GOTIFY_OIDC_ENABLED=false
# Base URL of the identity provider. It will be used to discover OIDC endpoints
# via /.well-known/openid-configuration.
#
# Type: text
# Example: https://auth.example.com/realms/myrealm
# GOTIFY_OIDC_ISSUER=
# Client ID registered with the identity provider for this application.
# Type: text
# Example: gotify
# GOTIFY_OIDC_CLIENTID=
# Client secret paired with the client ID.
# Type: text
# Example: super-secret
# GOTIFY_OIDC_CLIENTSECRET=
# Callback URL the identity provider redirects to after authentication. Must
# end with `/auth/oidc/callback` and match exactly what is registered at the
# provider. When Gotify is served on a sub-path behind a reverse proxy, include
# it (e.g. https://example.org/gotify/auth/oidc/callback). To support OIDC
# login in the Android app, also register `gotify://oidc/callback` as an
# additional redirect URL at the provider.
#
# Type: text
# Example: https://gotify.example.org/auth/oidc/callback
# GOTIFY_OIDC_REDIRECTURL=
# Automatically create a local user on first OIDC login. When disabled, only
# users that already exist in Gotify can sign in via OIDC.
#
# Type: boolean
# GOTIFY_OIDC_AUTOREGISTER=true
# Bind an OIDC identity to a pre-existing local user with a matching username
# on first login. When disabled (default), existing local users are never
# claimed by an OIDC login and an identity whose username is already taken is
# rejected
#
# Type: boolean
# GOTIFY_OIDC_LINK_BY_USERNAME=false
# OIDC ID-token claim used as the local username. Common values are
# preferred_username or email.
#
# Type: text
# Example: email
# GOTIFY_OIDC_USERNAMECLAIM=preferred_username
# OIDC ID-token claim containing the group memberships as a list of strings.
# The claim must be part of the requested scopes (GOTIFY_OIDC_SCOPES). When
# set, admin permissions are managed by the identity provider on every login,
# overwriting manual changes.
#
# Type: text
# Example: groups
# GOTIFY_OIDC_GROUPS_CLAIM=
# Groups allowed to log in via OIDC and whose members are assigned user
# permissions. When empty, every user authenticated by the identity provider
# may log in.
#
# Type: text-list
# Example: messenger,gotify
# GOTIFY_OIDC_GROUPS_USER=
# Groups allowed to log in via OIDC and whose members are assigned admin
# permissions.
#
# Type: text-list
# Example: admins,gotify-admins
# GOTIFY_OIDC_GROUPS_ADMIN=
# OIDC scopes to request from the identity provider.
# Type: text-list
# GOTIFY_OIDC_SCOPES=openid,profile,email
# Automatically redirect to the OIDC identity provider instead of showing the
# login page. Users can still reach the login form by visiting the WebUI login
# route with ?redirect=false, e.g. https://push.example.com/#/login?redirect=false
#
# Type: boolean
# GOTIFY_OIDC_AUTO_REDIRECT=false
# Value of the `prompt` parameter sent to the OIDC provider for authentication.
# The value is passed to the IdP (commas are replaced with space).
# Set to empty to disable sending the parameter.
#
# See: https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
# See: https://openid.net/specs/openid-connect-prompt-create-1_0.html#OpenID.Core
# Type: text-list
# Example: consent,login
# GOTIFY_OIDC_PROMPT=login
# Name of the OIDC identity provider displayed in UI.
# Type: text
# Example: Authelia
# GOTIFY_OIDC_IDP_NAME=OIDC
# Database driver to use. For mysql and postgres the target database must
# already exist and the configured user must have sufficient permissions.
#
# Type: one of sqlite3, mysql, postgres
# GOTIFY_DATABASE_DIALECT=sqlite3
# Database connection string. Format depends on the dialect.
# Type: text
# Example:
# sqlite3: path/to/database.db
# mysql: gotify:secret@tcp(localhost:3306)/gotifydb?charset=utf8&parseTime=True&loc=Local
# postgres: host=localhost port=5432 user=gotify dbname=gotifydb password=secret
# When using postgres without SSL, append `sslmode=disable` (see https://github.com/gotify/server/issues/90).
# GOTIFY_DATABASE_CONNECTION=data/gotify.db
# Username for the initial admin account. Only applied when the database is
# first created; later changes must be made through the WebUI.
#
# Type: text
# Example: myadmin
# GOTIFY_DEFAULTUSER_NAME=admin
# Password for the initial admin account. Only applied when the database is
# first created.
#
# Type: text
# Example: super-secret-password
# GOTIFY_DEFAULTUSER_PASS=admin
# Bcrypt cost factor for password hashes. Higher values are more secure but slower.
# Type: number
# GOTIFY_PASSSTRENGTH=10
# Directory where application icons and other uploaded images are stored. Must
# be writable by the server.
#
# Type: text
# Example: /var/lib/gotify/images
# GOTIFY_UPLOADEDIMAGESDIR=data/images
# Directory scanned for plugin shared libraries on startup. Leave empty to
# disable plugin loading.
#
# Type: text
# Example: /var/lib/gotify/plugins
# GOTIFY_PLUGINSDIR=data/plugins
# Allow unauthenticated users to register new user accounts via the public
# registration endpoint.
#
# Type: boolean
# GOTIFY_REGISTRATION=false
# Enable the Model Context Protocol endpoint at /mcp, allowing AI agents to
# send messages with an application token.
#
# Type: boolean
# GOTIFY_MCP_ENABLED=true
# Disable colored log output. Set to "1" to force-disable colors regardless of
# whether stdout is a terminal. When unset, colors are emitted only if stdout
# is a TTY. See https://no-color.org/.
#
# Type: text
# NOCOLOR=