Skip to content

Environment Variables

Variables for the gatelin container. Required variables are validated at boot — the process refuses to start if any are missing or invalid.

Required

VariableDescription
APP_NAMEApplication name used to build downstream service URLs ({APP_NAME}-{serviceName}-{ENV_NAME})
ENV_NAMEEnvironment name, e.g. local, staging, prod
PWD_CHECK_URLCredential-check endpoint of your password service. Its path is free — the mid-login endpoints are configured separately, see the Sessions contract
USER_SEARCH_URLURL of the user microservice search endpoint (login looks up users by email)
DB_HOSTHostname of the PostgreSQL container
DB_NAMEDatabase name (default: gatelin)
DB_USERDatabase user for Gatelin
DB_PWDDatabase password for Gatelin
TOKEN_SECRETSecret used to sign/verify JWT tokens, at least 32 characters
ACCESS_TOKEN_DURATIONAccess token lifetime in seconds (default: 600)
REFRESH_TOKEN_DURATIONRefresh token lifetime in seconds (default: 86400)

Optional

VariableDefaultDescription
PORT3000Port Gatelin listens on; also used as the port in downstream service URLs
SERVER_SCHEMEhttp://Scheme used in internal downstream URLs
TZContainer timezone
SESSION_RATE_LIMIT_MAX20Max login/refresh attempts per IP per 15 minutes
ADMIN_RATE_LIMIT_MAX300Max /gatelin/* admin API requests per consumer per minute (IP if unauthenticated)
PROXY_RATE_LIMIT_MAX200Max proxied HTTP and WebSocket-handshake requests per consumer per minute (IP if the route is public)
UPSTREAM_TIMEOUT_MS30000Idle timeout for outbound HTTP calls to microservices. Disabled for Server-Sent Events (Accept or upstream Content-Type of text/event-stream). WebSocket handshake uses this value until 101; the piped socket has no idle timeout.
UPSTREAM_MAX_SOCKETS256Max concurrent sockets per keep-alive agent (HTTP and HTTPS each).
UPSTREAM_MAX_FREE_SOCKETS64Max idle sockets retained in each keep-alive pool.
REFRESH_TOKEN_COOKIEWhen truthy, refresh tokens are also set as an httpOnly cookie (via toker-express)
REFRESH_TOKEN_COOKIE_NAMErefreshTokenName of the refresh-token cookie
REFRESH_TOKEN_COOKIE_SAMESITEstrictCookie SameSite (strict, lax, or none)
REFRESH_TOKEN_COOKIE_HTTPS_ONLYtrueCookie Secure flag; set to false for plain-HTTP local stacks
CSRF_COOKIE_NAMEcsrfTokenName of the CSRF double-submit cookie
PWD_CHALLENGES_URLunset (disabled)Endpoint that mints a mid-login challenge. Empty: login continues without 2FA / password-expiry pages
PWD_TRUSTED_DEVICES_URLunset (disabled)Endpoint that verifies a trusted-device cookie. Empty: the cookie is ignored
PWD_LOGIN_TICKET_URLunset (disabled)Endpoint that redeems a login ticket. Empty: Resume answers 501

Each password-service endpoint is configured on its own: Gatelin never derives one URL from another, so their paths do not have to share a prefix.

Admin UI

The Angular admin is built into the gatelin image and served only when ADMIN_PORT is set.

VariableDefaultDescription
ADMIN_PORTunset (disabled)Port the admin UI listens on. Unset to disable the admin UI.
ADMIN_BASE_PATH/adminPath prefix for the admin UI. Rewritten into <base href> at runtime — no Angular rebuild required. Must match your reverse-proxy rule.
ADMIN_PASSWORD_RECOVERY_URLunsetWhen set (e.g. /api/foxnox/web/recover), the login page shows a “Forgotten password ?” link. Injected at runtime into window.__GATELIN_ADMIN__ (dev entrypoint + prod admin-server). Leave empty to hide it. The local Compose stack’s Foxnox service serves recovery and mid-login challenge pages so you can try the link.
ADMIN_SSO_TOKEN_KEYsso_access_tokenlocalStorage key the admin UI stores the access token under. Injected at runtime like ADMIN_PASSWORD_RECOVERY_URL. Not app-prefixed by default so other admin UIs on the same origin can share the slot for cookie-based silent refresh — if you override it, set the same value on every app that should share that session.

Docker Compose examples often set ADMIN_BASE_PATH=/gatelin. That is an explicit override; the code default when the variable is unset remains /admin.

Database migration service

These apply to the gatelin-migration container (ghcr.io/alten-group/gatelin-migration):

VariableRequiredDescription
LIQUIBASE_COMMAND_USERNAMEPostgreSQL superuser used by Liquibase
LIQUIBASE_COMMAND_PASSWORDPassword for the Liquibase superuser
DB_HOSTHostname of the PostgreSQL container
DB_PORTPort of the PostgreSQL container (default: 5432)
DB_NAMEDatabase name to create and migrate
DB_USERApplication database user to create
DB_PWDPassword for the application database user
UPDATESet to 1 to run the full migration
ROLLBACKNumber of changesets to roll back (used instead of UPDATE)
SNAPSHOTPath to the reference snapshot file
LIQUIBASE_LOG_LEVELLiquibase log verbosity, e.g. INFO, DEBUG
LIQUIBASE_COMMAND_CONTEXTSLiquibase contexts to apply during migration
TZTimezone
  1. User logs in via POST /gatelin/sessions with { email, pwd }.
  2. Gatelin looks up the user via USER_SEARCH_URL, then verifies the password via PWD_CHECK_URL (any password service implementing the Sessions contract).
  3. If the password service reports lockout, expiry, or 2FA without a trusted device, Gatelin returns 202 with { challengeRequired, kind, url } instead of a session. The browser completes the challenge on the password service, comes back with ?ticket=…, and the client calls POST /gatelin/sessions/resume. Services that only check passwords never trigger this step.
  4. Otherwise (or after a successful resume), Gatelin issues a JWT access token (short-lived) and refresh token (long-lived), sets a CSRF cookie, and returns the session payload.
  5. Client sends the access token in Authorization: Bearer <token> on subsequent requests.
  6. When the access token expires, client calls PUT /gatelin/sessions with:
    • Authorization: Bearer <access_token> (expired tokens are accepted for refresh),
    • refresh token in the JSON body and/or cookie,
    • X-CSRF-Token header matching the CSRF cookie,
    • credentials: 'include' so cookies are sent.
  7. Logout (DELETE /gatelin/sessions) requires the access token and CSRF header; it archives the consumer and clears cookies.

See Sessions for the pwd-service contract and Frontend Integration for the client-side challenge/resume handling.

Maintenance Jobs

Gatelin runs two daily UTC cron jobs at startup:

JobScheduleRetention
Delete archived entities02:00 UTCRecords archived for more than 2 months
Delete old history03:00 UTCRows in log.history older than 6 months (tstamp column)

Archived entities purged: conditions (first, due to FK), then consumers, services, CORS origins, operations, resources, routes, roles, applications, scopes, and fields. Permissions are hard-deleted via the admin API and are not part of this job.

Published and maintained by ALTEN