--- title: "Polarity Server v5 Environment Variables - Configure Docker, DB, Cache &" slug: "polarity-server-environment-variables" description: "Polarity Server v5 lets you set environment variables in /app/.env to control Docker restarts, database connections, cache hosts, proxy URLs and audit logging." updated: 2026-08-11T15:19:52Z published: 2026-08-11T15:19:52Z canonical: "knowledge.threatconnect.com/polarity-server-environment-variables" --- > ## Documentation Index > Fetch the complete documentation index at: https://knowledge.threatconnect.com/llms.txt > Use this file to discover all available pages before exploring further. # Server Environment Variables Polarity Server environment variables can be configured by modifying the `.env` file located at `/app/.env`. > [!WARNING] > Modifications to the `.env` file will require a restart of the Polarity Server's Docker containers. > > ```shell > cd /app && ./down.sh && ./up.sh > ``` ## Variables ```shell MIX_ENV=prod POLARITY_HOSTNAME={{hostname of Polarity server}} POLARITY_HTTPS_PORT=4001 POLARITY_HTTP_PORT=4000 POLARITY_TLS_KEY_PATH=/app/certs/polarity_key.pem POLARITY_TLS_CERT_PATH=/app/certs/polarity.pem POLARITY_LICENSE=/app/license/polarity.lic POLARITY_PUBLIC_LICENSE_KEY=/app/license/server.crt POLARITY_DB_DATABASE=breach POLARITY_DB_HOST={{DB Host}} POLARITY_DB_PORT=5432 POLARITY_DB_USER=polarity POLARITY_DB_PASSWORD={{Password]] POLARITY_DB_CONNECTION_POOL_SIZE=50 POLARITY_DB_SECRET_KEY={{Secret_key}} POLARITY_DB_SUPERUSER_USER=breach POLARITY_DB_SUPERUSER_PASSWORD={{Secret Key}} POLARITY_METRICS_CACHE_HOST={{Cache Host}} POLARITY_METRICS_CACHE_PORT=8379 POLARITY_METRICS_CACHE_DB=1 POLARITY_METRICS_CACHE_MEMORY=0.1 POLARITY_USER_METRICS_COLLECTION=true POLARITY_INTEGRATION_CACHE_HOST={{cache host}} POLARITY_INTEGRATION_CACHE_PORT=7379 POLARITY_INTEGRATION_CACHE_DB=1 POLARITY_INTEGRATION_CACHE_MEMORY=0.1 POLARITY_INITIALIZE_REDIS_CONFIGS_ON_START=true POLARITY_INTEGRATIONS_ASSETS_FOLDER=/app/integrations/assets POLARITY_INTEGRATIONS_FOLDER=/app/integrations POLARITY_SECRET_SIGNING_SALT={{salt}} POLARITY_SECRET_KEY_BASE={{Key}} POLARITY_GUARDIAN_KEY_BASE={{Key}} POLARITY_LAUNCH_DARKLY_API_KEY=INVALID_POLARITY_LAUNCH_DARKLY_API_KEY POLARITY_RBAC_MODEL=/app/rbac_model.conf POLARITY_PLATFORM_API_HOSTNAME=https://polarity_platform:4001 POLARITY_LOG_INTEGRATION_LOOKUPS=verbose HTTP_PROXY=http://{{proxyhosntame}}:{{Proxy Port}} HTTPS_PROXY=https://{{proxyhosntame}}:{{Proxy Port}} NO_PROXY={{hostnames/IPS of services to ignore}},polarity_platform POLARITY_CONTAINER_GATEWAY=172.18.0.1 POLARITY_TOKEN_TTL_MINS=43200 POLARITY_CUSTOM_EMAILS_FOLDER=/app/emails ACME_ENABLED=false POLARITY_ENABLE_AUDIT_LOGGING=false POLARITY_LOG_FILE=log/polarity_audit_log.json POLARITY_LOG_ROTATION_SIZE=10485760 POLARITY_LOG_SAML=false HERMES_MCP_SERVER=true ``` ## Environment Variable Details | **Variable** | **Description** | **Default Value** | **Required?** | | --- | --- | --- | --- | | `MIX_ENV` | Server mode | `prod` | **Yes** | | `POLARITY_HOSTNAME` | Server hostname | *Hostname of the server* | **Yes** | | `POLARITY_HTTPS_PORT` | Platform container SSL service port | `4001` | **Yes** | | `POLARITY_HTTP_PORT` | Platform container HTTP service port | `4000` | **No** | | `POLARITY_TLS_KEY_PATH` | Path to Platform container private key | `/app/certs/polarity_key.pem` | **Yes** | | `POLARITY_TLS_CERT_PATH` | Path to Platform container public key | `/app/certs/polarity.pem` | **Yes** | | `POLARITY_LICENSE` | Path to Polarity Server License | `/app/license/polarity.lic` | **Yes** | | `POLARITY_PUBLIC_LICENSE_KEY` | Path to Polarity public signing key | `/app/license/server.crt` | **Yes** | | `POLARITY_DB_DATABASE` | Name of PostgreSQL database | `postgres` | **Yes** | | `POLARITY_DB_HOST` | Name of PostgreSQL database container or host serving PG database | `polarity_platform_local_postgres` | **Yes** | | `POLARITY_DB_PORT` | PostgreSQL service port | `5432` | **Yes** | | `POLARITY_DB_USER` | PostgreSQL user name | `polarity` | **Yes** | | `POLARITY_DB_PASSWORD` | PostgreSQL user password | *Generated at install* | **Yes** | | `POLARITY_DB_CONNECTION_POOL_SIZE` | Maximum number of connections for PostgreSQL database (50 is the maximum) | `50` | **Yes** | | `POLARITY_DB_SECRET_KEY` | PostgreSQL access secret key | *Generated at install* | **Yes** | | `POLARITY_DB_SUPERUSER_USER` | PostgreSQL super user name | `breach` | **No** | | `POLARITY_DB_SUPERUSER_PASSWORD` | PostgreSQL super user password | *Password from v4 Server* | **No** | | `POLARITY_METRICS_CACHE_HOST` | Name of Metrics Cache database container or host serving Metrics Cache database | `polarity_metrics_cache` | **Yes** | | `POLARITY_METRICS_CACHE_PORT` | Metrics Cache service port | `8379` | **Yes** | | `POLARITY_METRICS_CACHE_DB` | Index number of Redis database to use for metrics cache | `1` | **Yes** | | `POLARITY_METRICS_CACHE_MEMORY` | Percent of system memory allowed for Metrics Cache database | `0.1` | **Yes** | | `POLARITY_USER_METRICS_COLLECTION` | Collect user metrics* | `true` | **Yes** | | `POLARITY_INTEGRATION_CACHE_HOST` | Name of Integration Cache database container or host serving Integration Cache database | `polarity_integration_cache` | **Yes** | | `POLARITY_INTEGRATION_CACHE_PORT` | Integration Cache service port | `7379` | **Yes** | | `POLARITY_INTEGRATION_CACHE_DB` | Index number of Redis database to use for integration cache | `1` | **Yes** | | `POLARITY_INTEGRATION_CACHE_MEMORY` | Percent of system memory allow for Integration Cache database | `0.1` | **Yes** | | `POLARITY_INITIALIZE_REDIS_CONFIGS_ON_START` | Allow Polarity to configure Redis-based caches on start (for non-containerized installs) | `false` | **Yes** | | `POLARITY_INTEGRATIONS_ASSETS_FOLDER` | Location of integration assets directory | `/app/integrations/assets` | **Yes** | | `POLARITY_INTEGRATIONS_FOLDER` | Location of integrations directory | `/app/integrations` | **Yes** | | `POLARITY_SECRET_SIGNING_SALT` | Session key generation salt | *Generated at install* | **Yes** | | `POLARITY_SECRET_KEY_BASE` | Session key generation base | *Generated at install* | **Yes** | | `POLARITY_GUARDIAN_KEY_BASE` | Signing key base used for JWTs | *Generated at install* | **Yes** | | `POLARITY_LOG_INTEGRATION_LOOKUPS` | Logging level for integration lookups (used in Polarity Source Analytics)*SEE NOTE | `verbose` | **Yes** | | `POLARITY_LAUNCH_DARKLY_API_KEY` | 3rd party feature flag monitoring and collection platform (**disabled by default**) | `INVALID_POLARITY_LAUNCH_DARKLY_API_KEY` | **Yes** | | `POLARITY_RBAC_MODEL` | Location of RBAC configuration template | `/app/rbac_model.conf` | **Yes** | | `POLARITY_WEB_HOSTNAME` | Server hostname (must match certificate hostname for proper operation) | *Hostname of the server* | **Yes** | | `POLARITY_PLATFORM_API_HOSTNAME` | Platform container API service port | `https://polarity_platform:4001` | **Yes** | | `HTTPS_PROXY` | HTTPS traffic proxy (outgoing) | N/A | **No** | | `HTTP_PROXY` | HTTP traffic proxy (outgoing) | N/A | **No** | | `NO_PROXY` | Proxy exception settings | `polarity_platform,localhost,172.18.0.1,172.18.0.0/16` | **Yes** | | `POLARITY_CONTAINER_GATEWAY` | Container environment network gateway | `172.18.0.1` | **Yes** | | `POLARITY_TOKEN_TTL_MINS` | User JWT time-to-live setting (**Platform v5.5.0+**) | `43200` | **No** | | `POLARITY_CUSTOM_EMAILS_FOLDER` | Location of custom email templates (**Platform v5.5.0+**) | N/A | **No** | | `ACME_ENABLED` | Allow Caddy to use ACME to manage certificates automatically (**Platform v5.6.0+**) | `false` | **No** | | `POLARITY_ENABLE_AUDIT_LOGGING` | Enable Polarity Audit Logging (**Platform v5.6.0+**) | `false` | **No** | | `POLARITY_LOG_FILE` | Set custom relative file path for Polarity Audit Logging (**required if** `POLARITY_ENABLE_AUDIT_LOGGING` **is enabled**) (**Platform v5.6.0+**) | N/A *(suggest* `/app/log/polarity_audit_log.json` *) **SEE NOTE* | ***Conditional*** | | `POLARITY_LOG_ROTATION_SIZE` | Set custom log rotation size, in bytes (**required if** `POLARITY_ENABLE_AUDIT_LOGGING` **is enabled**) (**Platform v5.6.0+**) | N/A | ***Conditional*** | | `POLARITY_LOG_SAML` | Enable enhanced SAML logging for troubleshooting (**Platform v5.6.0+**) | `false` | **No** | | `HERMES_MCP_SERVER` | Enable the Polarity MCP Server (**Platform v5.7.0+**) | `false` | **No** | > [!NOTE] > ** Note regarding Polarity Audit Logging file location > > Additional configuration is required to set the logging file location, as the `polarity_platform` container must be able to read and write at this location. > > [**See this location in the documentation to complete the set up for this facility.**](/v1/docs/polarity-server-logs#to-enable-polarity-audit-logging) > [!TIP] > * Note regarding Collection and Logging on Polarity Systems > > Polarity by ThreatConnect **does not receive or collect any information or telemetry** from your on-premise Polarity instance. > > Polarity by ThreatConnect will only collect metrics and telemetry from our SaaS instances as needed to ensure availability and user experience. > > Please reach out to us if you have any questions.