Skip to main content
Version: 1.2

Settings file and environment variables

Complete reference for configuring ToBeAlert in Docker, Kubernetes, and bare-metal deployments.

How configuration works​

ToBeAlert uses three layers. Higher layers override lower ones:

PriorityMechanismApplies to
1Environment variablesBackend (selected keys), frontend container, PostgreSQL image
2/tobealert/config/tobealertd.confBackend only
3Built-in defaultsDefault values shipped in the backend image

The active settings file path is fixed: /tobealert/config/tobealertd.conf. It cannot be changed.

On first backend container start:

  1. Copies /tobealert/config/tobealertd.conf.example → tobealertd.conf (if missing)
  2. Replaces SECRET_KEY = 'CHANGEME' with a random value
  3. Creates the bootstrap UI user from ADMIN_USER / ADMIN_PASSWORD (if that user does not exist)

Environment variable formats​

TypeFormat in envExample
Booleantrue, yes, on, 1, enabled, …DEBUG=true
ListComma-separatedPLUGINS=delay,notifications
Integer / stringPlain valueREDIS_PORT=6379

Frontend (tobealert-frontend)​

All frontend runtime configuration is done with environment variables (injected at container start; nginx substitutes them into the config).

VariableRequiredDefaultDescription
BASE_URLYes—URL the browser uses to open the web UI (scheme + host + port, no trailing path). Example: http://localhost or https://alerts.example.com
API_URLYes—URL the browser uses for API calls (JavaScript fetch). Example: http://localhost:9000 or https://api.example.com
BACKEND_SERVICEYes—Hostname nginx uses as upstream for /api and /management. In Docker Compose: backend service name (e.g. tobealert-backend). In Kubernetes: backend Service DNS name (e.g. tobealerta-backend-svc)
BACKEND_PORTYes9000TCP port of the backend upstream

Nginx proxies to:

http://${BACKEND_SERVICE}:${BACKEND_PORT}

BACKEND_SERVICE must resolve on the same network as the frontend pod/container (not localhost unless using network_mode: host).


PostgreSQL (tobealert-bbdd)​

Standard PostgreSQL Docker image variables.

VariableRequiredDefaultDescription
POSTGRES_USERYes—Database user created on first init
POSTGRES_PASSWORDYes—Password for POSTGRES_USER
POSTGRES_DBYes—Database name created on first init
TZNo—Container timezone (e.g. Europe/Madrid)
POSTGRES_HOST_AUTH_METHODNoscram-sha-256Auth method (dev stacks sometimes use trust)

DATABASE_URL in the backend must match these credentials and use the DB hostname reachable from the backend (tobealert-bbdd in Compose, not localhost).


Backend — overview​

CategoryVariablesPurpose
Bootstrap (first start)ADMIN_USER, ADMIN_PASSWORDFirst UI superadmin
API adminAPI_ADMIN_USER, API_ADMIN_PASSWORDHTTP Basic Auth on selected admin API routes
RuntimeSee full table belowLoaded at backend startup
AdditionalTOBEALERT_*, SSL_*, …Read directly from the environment
Image defaultsFLASK_SKIP_DOTENV, TOBEALERT_ENDPOINTSet in the backend image
Config file onlyRemaining optionsSet in tobealertd.conf

Two different “admin” credentials​

UI superadminAPI admin
VariablesADMIN_USER, ADMIN_PASSWORDAPI_ADMIN_USER, API_ADMIN_PASSWORD
Used forLogin in the web UI; created by entrypointHTTP Basic Auth (Authorization: Basic …) on admin API endpoints
DefaultMust be set in Compose/K8sadmin / admin (image default — change in production)

Bootstrap (first container start)​

Used only when the backend container starts for the first time; not loaded from tobealertd.conf.

VariableRequiredDescription
ADMIN_USERYesUsername for the bootstrap superadmin (also used as default ADMIN_USERS entry and superadmin flag in the UI)
ADMIN_PASSWORDYesPassword for that user on first creation

API admin (HTTP Basic Auth)​

Applied at backend startup for HTTP Basic Auth on selected admin API routes.

VariableRequiredDefaultDescription
API_ADMIN_USERRecommendedadminHTTP Basic Auth username
API_ADMIN_PASSWORDRecommendedadminHTTP Basic Auth password

Change both in production.


Backend — runtime environment variables​

These variables are loaded at backend startup. Environment values override matching keys in tobealertd.conf, which in turn override built-in defaults.

General and security​

VariableDefaultDescription
DEBUGfalseDebug mode
TZUTCTimezone for scheduled tasks and internal timestamps. Use this in Docker env (not TIMEZONE; see config file)
SECRET_KEY''Signing key for sessions/JWT. Usually auto-generated on first start if conf contains CHANGEME
BASE_URL''Public base URL of the backend (absolute links)
TRUST_PROXY_HEADERStrueTrust X-Forwarded-* headers behind a reverse proxy

Database and Redis​

VariableDefaultDescription
DATABASE_URLpostgres://tobealert:tobealert@localhost:5432/tobealertPostgreSQL connection URL
DATABASE_NAMEtobealertDatabase name (if not only in URL)
DATABASE_SCHEMApublicPostgreSQL schema
REDIS_HOSTlocalhostRedis hostname (Compose service name, e.g. tobealert-redis)
REDIS_PORT6379Redis TCP port

Redis database indices are fixed (broker 0, backend 1, alerts 2, healthcheck 3).

Authentication and users​

VariableDefaultDescription
AUTH_REQUIREDtrueRequire authentication for API access
ADMIN_USERS[ADMIN_USER]Comma-separated admin usernames
SIGNUP_ENABLEDtrueAllow user self-registration
LOCAL_LOGIN_ENABLEDtrueEnable local username/password login
ALLOWED_EMAIL_DOMAINS*Comma-separated allowed email domains for signup
CORS_ORIGINSsee conf templateComma-separated allowed CORS origins

LDAP and SAML use external auth providers in the UI / API (auth_providers). They are not configured with global LDAP_* / SAML2_* environment variables.

Mail (SMTP)​

VariableDefaultDescription
MAIL_FROM—Sender email address
SMTP_HOSTsmtp.office365.comSMTP server hostname
SMTP_PORT587SMTP port
SMTP_PASSWORD—SMTP password
SMTP_STARTTLStrueEnable STARTTLS
SMTP_USE_SSLfalseUse SSL/TLS for SMTP

SMTP_USERNAME is set in tobealertd.conf only (not available as an environment variable).

Plugins, environments, and housekeeping​

VariableDefaultDescription
PLUGINSsee conf templateComma-separated plugin names
ALLOWED_ENVIRONMENTSProductionComma-separated alert environments accepted
DEFAULT_ENVIRONMENTProductionDefault environment for webhooks (must be in ALLOWED_ENVIRONMENTS)
ORIGIN_BLACKLIST—Comma-separated origin patterns to reject
BLACKOUT_DURATION3600Default blackout period (seconds)
NOTIFICATION_BLACKOUTfalseIf true, set alert status to blackout instead of dropping
BLACKOUT_ACCEPT—Comma-separated severities still processed during blackout
DELETE_EXPIRED_AFTER7200Delete alerts with status closed or expired after N seconds since last_receive_time (0 = never)
DELETE_INFO_AFTER43200Delete informational-severity alerts after N seconds (0 = never)
DEFAULT_EXPIRED_DELETE_HRS—Legacy: hours, converted to seconds for DELETE_EXPIRED_AFTER
HK_EXPIRED_DELETE_HRS—Legacy alias
DEFAULT_INFO_DELETE_HRS—Legacy: hours for informational delete
HK_INFO_DELETE_HRS—Legacy alias
DELAY_NOTIFICATION—Notification delay in minutes (conf template uses NOTIFICATION_DELAY)
DEMO_MODEfalseEnable demo mode
DEMO_CLEANUP_HOURS24Demo data retention (hours)
QA_MODEfalseEnable QA mode
FLAPPING_TIME_WINDOW60Flapping detection window (minutes)
FLAPPING_CHANGE_THRESHOLD4Status changes before marking flapping
CLIPBOARD_TEMPLATE—Template for clipboard copy in the UI
INSTRUCTION_LINK_TEMPLATE${event}Template to resolve instruction paths from alert fields

Backend — additional environment variables​

These are read directly from the environment at startup (not merged through the main configuration loader).

VariableDefaultDescription
TOBEALERT_DEBUGfalseEnable debug behaviour in the app
TOBEALERT_SKIP_PERMISSION_CHECKfalseSkip filesystem permission checks (development only)
ALERTA_SVR_CONF_FILE—Path to an additional configuration file loaded after tobealertd.conf
SSL_CERT—TLS certificate file path for the backend server
SSL_KEY—TLS private key file path
FLASK_DEBUG—Set to 1 for indented JSON in logs
TOBEALERT_ENDPOINThttp://localhost:9000/apiDefault API URL for the CLI client
ALERTA_API_KEY—API key for the CLI client
TELEGRAM_TOKEN—Telegram bot token (Telegram webhook)
TELEGRAM_CHAT_ID—Telegram chat ID
DASHBOARD_URL—Dashboard URL linked from Telegram notifications
NOTIFY_<name>—PostgreSQL NOTIFY script: custom channel names
NOTIFY_PARAMETER_<name>—PostgreSQL NOTIFY script: parameters (uppercase suffix)

Backend — image built-in environment​

Set in the backend image; normally do not override.

VariableValueDescription
FLASK_SKIP_DOTENV1Disable automatic .env file loading
TOBEALERT_ENDPOINThttp://localhost:9000/apiDefault endpoint for CLI tooling inside the image

Plugins and arbitrary env keys​

Plugins can read matching environment variables before falling back to tobealertd.conf. In practice, plugin-specific options are usually set in tobealertd.conf using the same key names as in the shipped template.


Configuration file (tobealertd.conf)​

Python-style KEY = value file. Use for options that are not listed in runtime environment variables, or when you prefer file-based config (SNMP traps, UI columns, etc.).

Template shipped in the image: /tobealert/config/tobealertd.conf.example

Keys commonly set in the file (not available as env vars)​

Below: key name in tobealertd.conf, default, and purpose. Set these in tobealertd.conf unless noted otherwise.

Logging​

KeyDefaultDescription
LOG_CONFIG_FILE''External logging config file
LOG_HANDLERSconsole,fileLog handlers
LOG_FILE/tobealert/logs/tobealertd.logMain log file path
TASKS_LOG_FILE/tobealert/logs/tasks.logBackground tasks log
PLUGINS_LOG_FILE/tobealert/logs/plugins.logPlugins log
NOTIFICATIONS_LOG_FILE/tobealert/logs/notifications.logNotifications log
LOG_LEVELWARNINGDEBUG, INFO, WARNING, ERROR, CRITICAL
LOG_MAX_BYTES10485760Max log file size before rotation
LOG_BACKUP_COUNT2Rotated log files to keep
LOG_FORMATdefaultLog format name
LOG_FACILITYlocal7Syslog facility
LOG_METHODSHTTP methods listMethods to log

API and alerts​

KeyDefaultDescription
ALARM_MODELALERTAALERTA or ISA_18_2
QUERY_LIMIT50Max alerts per query
DEFAULT_PAGE_SIZE50Default page size
HISTORY_LIMIT100Max alert history entries
HISTORY_ON_VALUE_CHANGEtrueHistory on duplicate with value change
DATABASE_RAISE_ON_ERRORtrueRaise on DB errors
DEFAULT_FIELDtextDefault Postgres search field

Roles and scopes​

KeyDefaultDescription
ADMIN_ROLESadminRole names treated as admin
DEFAULT_USER_ROLEuserDefault role for new users
USER_ROLESuserValid roles
USER_DEFAULT_SCOPESread,writeDefault API scopes
CUSTOM_SCOPES—Additional scopes
DELETE_SCOPES—Scopes required to delete alerts
ALLOW_READONLYfalseAllow read-only mode
READONLY_SCOPESreadRead-only scopes
BASIC_AUTH_REALMToBeAlertBasic auth realm string

Auth proxy​

KeyDefaultDescription
AUTH_PROXYfalseEnable reverse-proxy authentication
AUTH_PROXY_USER_HEADERX-Proxy-UserHeader with authenticated username
AUTH_PROXY_ROLES_HEADERX-Proxy-RolesHeader with role list
AUTH_PROXY_ROLES_SEPARATOR,Separator for roles header
AUTH_PROXY_AUTO_SIGNUPtrueAuto-create users from proxy auth

LDAP and SAML (external auth providers only)​

LDAP and SAML are configured in the UI or via the auth_providers API. Do not set legacy global keys (LDAP_*, SAML2_*, etc.) for login — they are not used.

Tokens and audit​

KeyDefaultDescription
TOKEN_EXPIRE_DAYS14User token lifetime
API_KEY_EXPIRE_DAYS365API key lifetime
AUDIT_TRAILadminAudit categories: admin, write, auth
AUDIT_LOG—Log audit events to application log
AUDIT_LOG_REDACTtrueRedact sensitive fields in audit log
AUDIT_LOG_JSONfalseLog alert payload as JSON
AUDIT_URL—Webhook URL for audit events

CORS and severity​

KeyDescription
CORS_ALLOW_HEADERSAllowed request headers
CORS_SUPPORTS_CREDENTIALSAllow credentials in CORS
SEVERITY_MAPCustom severity mapping
DEFAULT_NORMAL_SEVERITYDefault normal severity
DEFAULT_INFORM_SEVERITYDefault informational severity
DEFAULT_PREVIOUS_SEVERITYDefault previous severity
COLOR_MAPSeverity → colour mapping

Alert timeouts and housekeeping (file)​

KeyDefaultDescription
ALERT_TIMEOUT86400Alert auto-close timeout (s)
HEARTBEAT_TIMEOUT86400Heartbeat timeout (s)
HEARTBEAT_MAX_LATENCY2000Max heartbeat latency (ms)
ACK_TIMEOUT0Auto-unack after N seconds (0 = off)
SHELVE_TIMEOUT7200Auto-unshelve after N seconds
CLEANUP_FREQUENCY3600Celery Beat interval for run_housekeeping (s)
ENABLEDtrueMaster switch for housekeeping tasks
DELETE_CLOSED_AFTER86400Legacy / unused — closed alerts are deleted by DELETE_EXPIRED_AFTER; kept for old conf files
DELETE_RESOLVED_AFTER604800Legacy / unused — no resolved status delete path
DELETE_CLEARED_AFTER259200Legacy / unused — no cleared-severity delete path

Email (file)​

KeyDescription
EMAIL_VERIFICATIONRequire email verification on signup
SMTP_USERNAMESMTP username
MAIL_LOCALHOSTHELO/EHLO hostname
SSL_KEY_FILESMTP SSL key
SSL_CERT_FILESMTP SSL cert
NOTIFICATION_SEVERITIESSeverities that trigger email

Web console (file)​

KeyDescription
SITE_LOGO_URLCompany logo URL
DATE_FORMAT_LONG_DATELong date format string
DATE_FORMAT_MEDIUM_DATEMedium date format
DATE_FORMAT_SHORT_TIMEShort time format
DEFAULT_AUDIO_FILEDefault alert sound path/URL
COLUMNSAlert list columns
SORT_LIST_BYDefault sort order
DEFAULT_FILTERDefault alert filter
ASI_SEVERITYAlert Status Indicator severities
ASI_QUERIESASI preset queries
DEFAULT_FONTAlert list font settings
ACTIONSCustom alert actions
SERVER_VERSIONShow server version: full, major, off
AUTO_REFRESH_INTERVALUI refresh interval (ms)

Routing, plugins, webhooks (file)​

KeyDescription
ROUTING_DISTRouting distribution name
PLUGINS_RAISE_ON_ERRORStop on first plugin error
FWD_DESTINATIONSNorthbound forward destinations
GRAFANA_TAGS_AS_ATTRIBUTESGrafana webhook: tags as attributes
GRAFANA_TAGS_AS_TAGSGrafana webhook: tags as tags
POLICY_CONTAINER_PATHPolicies directory path

Timezone (file)​

KeyDefaultDescription
TIMEZONEEurope/MadridDisplay and time formatting in the UI. For Docker env prefer TZ

SNMP trap receiver (file)​

KeyDefaultDescription
SNMP_TRAP_ENABLEDfalseEnable built-in SNMP trap receiver
SNMP_TRAP_BIND_ADDRESS0.0.0.0Listen address
SNMP_TRAP_BIND_PORT162 / 1162 in templateListen UDP port
SNMP_TRAP_ALLOWED_IPS[]Allowed source IPs/CIDRs
SNMP_TRAP_RATE_LIMIT_REQUESTS100Max traps per window
SNMP_TRAP_RATE_LIMIT_WINDOW60Rate limit window (s)
SNMP_TRAP_COMMUNITY_STRINGSpublicSNMPv1/v2c communities
SNMP_TRAP_V3_USERS[]SNMPv3 user definitions
SNMP_TRAP_MIBS_PATH—MIBs directory (template)
SNMP_TRAP_MIBSALLMIB modules to load (template)
SNMP_TRAP_DEFAULT_ENVIRONMENT—Default alert environment
SNMP_TRAP_DEFAULT_SERVICESNMPDefault service name
SNMP_TRAP_DEFAULT_GROUPNetworkDefault group

Redis (file)​

KeyDefaultDescription
REDIS_DB_ALERTS2Redis DB index for alerts cache

Minimal Docker Compose example​

services:
tobealert-bbdd:
image: postgres:17.5-alpine
environment:
POSTGRES_USER: tobealert
POSTGRES_PASSWORD: tobealert
POSTGRES_DB: tobealert
TZ: Europe/Madrid

tobealert-redis:
image: redis:latest

tobealert-backend:
image: tobek8s/tobealert-backend:latest
environment:
ADMIN_USER: tbadmin
ADMIN_PASSWORD: changeme
API_ADMIN_USER: apiadmin
API_ADMIN_PASSWORD: changeme-api
DATABASE_URL: postgres://tobealert:tobealert@tobealert-bbdd:5432/tobealert
REDIS_HOST: tobealert-redis
REDIS_PORT: "6379"
TZ: Europe/Madrid

tobealert-frontend:
image: tobek8s/tobealert-frontend:latest
environment:
BASE_URL: http://localhost
API_URL: http://localhost:9000
BACKEND_SERVICE: tobealert-backend
BACKEND_PORT: "9000"

Replace placeholder passwords (changeme, changeme-api) and default API admin credentials before production use.