Русский
Academy: all guides

Operator · Core server

The Core environment file and server settings

Where the env file lives, what is set at startup, what belongs in Admin, and when a restart is required. No live secrets and no universal paths.

Where the file lives

Core runs as a systemd service. EnvironmentFile= in its unit file names the file the process reads at startup. There is no universal path: the portable Orange template uses /srv/mm/hoba-staging/native/core.env, the public standalone build uses /etc/hoba-public/core.env, and another installation may choose its own protected path.

List the files with systemctl show -p EnvironmentFiles <unit>. If there is more than one, a later file can override an earlier value. Edit the file for the service this installation runs.

Permissions. The file belongs to the service account or root, mode 0600; it is outside media, admin, and published site directories.

Syntax

This is the systemd EnvironmentFile format, not a shell script. One KEY=value per line; lines starting with # are comments. Do not write export and do not use $VAR or $(...): systemd does not run commands or expand variables. Quote a value that contains spaces.

Do not put several assignments or conditions on one line. For a path or address, simple HOBA_BIND=127.0.0.1:8788 is enough.

What is set at startup

The env file holds values needed before the database or values that select the database. Main examples:

  • HOBA_DATABASE_URL is the required PostgreSQL URL unless the installation already saved a setup profile. HOBA_GENERATION_TOKEN_SECRET is a required secret of at least 32 bytes. HOBA_CSRF_TOKEN_SECRET and HOBA_CAPTCHA_TOKEN_SECRET are optional and fall back to the generation secret.

  • HOBA_BIND is the internal HTTP address, default 127.0.0.1:8788. HOBA_PUBLIC_BIND is an optional second loopback listener for publication. HOBA_TRUSTED_PROXY controls proxy-header trust; see below.

  • HOBA_SECURE_COOKIES follows https from the stored public URL by default; it can be set to true. HOBA_PUBLIC_CSP is an optional CSP mode: the default is trusted-same-origin, and opaque enables isolation.

  • Paths: HOBA_MEDIA_ROOT (default ./media), HOBA_ADMIN_ROOT, HOBA_COMPOSER_ROOT, HOBA_PLUGINS_DIR.

  • Provider and analytics secrets: HOBA_AI_API_KEY, HOBA_ANALYTICS_SECRET, HOBA_STATS_IP_SALT. The AI URL, model, and timeouts are already runtime settings.

  • First start: HOBA_SETUP_TOKEN_SHA256, HOBA_SETUP_CONFIG_FILE, HOBA_SETUP_DB_ALLOWED_HOSTS. A saved setup profile is read before HOBA_DATABASE_URL.

  • Whether to start a separate worker, for example HOBA_MAINTENANCE_ENABLED, is also fixed at startup. Other intervals and toggles are runtime settings.

Admin, database, and restarts

Non-secret settings that do not need the file live under Admin → Connections → Runtime settings: AI URL, model, and timeouts; worker intervals; retention; backup/update paths; and rate limits. They are stored in PostgreSQL. Core reads them while running, and the env variable remains a fallback. Admin shows the effective value and its source: setting, env, or default.

Editing the env file requires a restart: systemd reads it only when Core starts. Some values are also fixed inside the process: bind/listeners, trusted proxy, paths, secrets, CSP, first-start settings, and whether a separate worker starts. If you change those in Admin, only what is actually re-read applies; when in doubt, restart the service and check readiness.

Public origins and CORS are set in Admin → Connections, not in env. After changing the public origin, restart Core so startup OAuth and cookie configuration refresh. Current Core does not read HOBA_PUBLIC_URL, HOBA_SITES_PUBLIC_URL, or HOBA_ALLOWED_ORIGINS.

Safe example

This is the shape of the file, not ready-to-use values. Replace everything in angle brackets from your secret store; do not copy the example into a working file without replacements.

  • HOBA_DATABASE_URL=postgresql://hoba@127.0.0.1:5432/hoba

  • HOBA_GENERATION_TOKEN_SECRET=<32+ random bytes from the secret store>

  • HOBA_BIND=127.0.0.1:8788

  • HOBA_TRUSTED_PROXY=0

  • HOBA_SECURE_COOKIES=true

  • HOBA_MEDIA_ROOT=/srv/hoba/media

  • HOBA_ADMIN_ROOT=/srv/hoba/admin

  • HOBA_COMPOSER_ROOT=/srv/hoba/composer

  • HOBA_PLUGINS_DIR=/srv/hoba/plugins

Secrets. HOBA_DATABASE_URL may contain a password; HOBA_GENERATION_TOKEN_SECRET, HOBA_CSRF_TOKEN_SECRET, HOBA_CAPTCHA_TOKEN_SECRET, HOBA_AI_API_KEY, HOBA_ANALYTICS_SECRET, and HOBA_STATS_IP_SALT are also secrets. Keep them only in a protected env file or the standard secret manager, not in Git, Admin, the database, a theme, an issue, or logs. Do not print the file with cat or systemctl show-environment. To rotate, replace the value and restart Core; old generation tokens stop working.

Loopback nginx and HOBA_TRUSTED_PROXY

Core trusts a reverse proxy by default when every HTTP listener binds to loopback. With a loopback HOBA_BIND, HOBA_TRUSTED_PROXY may be omitted. If HOBA_BIND listens on an external interface, trust is off by default.

HOBA_TRUSTED_PROXY=0 explicitly disables trust even on loopback. HOBA_TRUSTED_PROXY=1 forces it on; use it only when the trusted nginx is the only path to Core and the immediate TCP peer is really loopback. Trust does not replace restricting access to the port.

Loopback nginx must overwrite incoming headers, not append to a client chain:

  • proxy_set_header Host $host;

  • proxy_set_header X-Forwarded-For $remote_addr;

  • proxy_set_header X-Forwarded-Host $host;

  • proxy_set_header X-Forwarded-Proto $scheme;

Core prefers X-Forwarded-Host only when proxy trust is on. Client IP attribution in the rate limiter additionally needs a loopback peer and one valid X-Forwarded-For value. If nginx does not overwrite X-Forwarded-For, a client can supply someone else’s address. Preserve a non-default port with $http_host.

How to check

After a restart, check the internal address from HOBA_BIND (default 127.0.0.1:8788):

  • GET /health checks the process and database access.

  • GET /ready checks readiness; wait for migrationsPending == 0. A fresh installation may return 503 SETUP_REQUIRED.

  • GET /version reports the installed build and contract.

Check service state and startup errors with systemctl status <unit> and journalctl -u <unit>. Do not print the env file or copy the environment into a report: logs should not contain secrets, but an extra copy is unnecessary.

Admin → Connections shows effective public origins and their source; Runtime settings shows the value and source setting/env/default. Secrets are not displayed there. If something did not apply, check the unit and the EnvironmentFile= path first, then /health and /ready, then the setting’s source in Admin.