Server Environment Variables
  • 30 Jun 2025
  • 1 Minute to read
  • Dark
    Light

Server Environment Variables

  • Dark
    Light

Article summary

Server environment variables can be configured by modifying the .env file located at /app/.env.

Modifications to the .env file will require a restart of the Polarity Server's Docker containers:

cd /app && ./down.sh && ./up.sh

Variables

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

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 (if needed)

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)*

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

N/A

No

HTTP_PROXY

HTTP traffic proxy

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

* 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.


Was this article helpful?