You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "A reference page listing all environment variables for the API and Frontend."
2
+
title: 'Environment Variables'
3
+
description: 'A reference page listing all environment variables for the API and Frontend.'
4
4
sidebar_position: 20
5
5
---
6
6
7
-
This page provides a comprehensive reference for all the environment variables you can use to configure your self-hosted Flagsmith instance. You'll find variables for both the API and the frontend, along with a brief description of what each one does. Use this as a handy guide when setting up or tweaking your deployment, whether you're running locally, in the cloud, or on Kubernetes. If you're not sure what a particular variable does, or whether you need to set it, check the relevant section below for more details.
7
+
This page provides a comprehensive reference for all the environment variables you can use to configure your self-hosted
8
+
Flagsmith instance. You'll find variables for both the API and the frontend, along with a brief description of what each
9
+
one does. Use this as a handy guide when setting up or tweaking your deployment, whether you're running locally, in the
10
+
cloud, or on Kubernetes. If you're not sure what a particular variable does, or whether you need to set it, check the
11
+
relevant section below for more details.
8
12
9
13
## API Environment Variables
10
14
@@ -13,41 +17,66 @@ This page provides a comprehensive reference for all the environment variables y
13
17
-`REDIS_URL`: The URL of your Redis instance.
14
18
-`ENV`: The environment the application is running in, e.g. "prod".
15
19
-`SENTRY_DSN`: If you want to send errors to Sentry, specify the DSN here.
16
-
-`SENTRY_TRACE_SAMPLE_RATE`: The percentage of transactions to trace in Sentry. See [Sentry's documentation](https://docs.sentry.io/platforms/python/performance/instrumentation/django/#configure) for more info.
20
+
-`SENTRY_TRACE_SAMPLE_RATE`: The percentage of transactions to trace in Sentry. See
21
+
[Sentry's documentation](https://docs.sentry.io/platforms/python/performance/instrumentation/django/#configure) for
22
+
more info.
17
23
-`LOG_LEVEL`: The log level to output at. One of `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`.
18
24
-`LOG_FORMAT`: The format to use for logging. One of `generic` or `json`.
19
25
-`DJANGO_SECRET_KEY`: A long, random and unique string used for cryptographic signing.
20
-
-`ACCESS_LOG_LOCATION`: The location to store web logs generated by Gunicorn if running as a Docker container. If not set, no logs will be stored. If set to `-`, the logs will be sent to `stdout`.
26
+
-`ACCESS_LOG_LOCATION`: The location to store web logs generated by Gunicorn if running as a Docker container. If not
27
+
set, no logs will be stored. If set to `-`, the logs will be sent to `stdout`.
21
28
-`DJANGO_SETTINGS_MODULE`: Python path to settings file for the given environment, e.g. "app.settings.develop"
22
-
-`ALLOW_ADMIN_INITIATION_VIA_CLI`: Enables the `bootstrap` management command which creates default admin user, organisation, and project.
29
+
-`ALLOW_ADMIN_INITIATION_VIA_CLI`: Enables the `bootstrap` management command which creates default admin user,
30
+
organisation, and project.
23
31
-`ADMIN_EMAIL`: Email to use for the default superuser creation.
24
32
-`ORGANISATION_NAME`: Organisation name to use for the default organisation.
25
33
-`PROJECT_NAME`: Project name to use for the default project.
26
34
-`ENABLE_GZIP_COMPRESSION`: If Django should gzip compress HTTP responses. Defaults to `False`.
27
35
-`GOOGLE_ANALYTICS_KEY`: If Google Analytics is required, add your tracking code.
28
-
-`GOOGLE_SERVICE_ACCOUNT`: Service account JSON for accessing the Google API, used for getting usage of an organisation - needs access to analytics.readonly scope.
36
+
-`GOOGLE_SERVICE_ACCOUNT`: Service account JSON for accessing the Google API, used for getting usage of an
37
+
organisation - needs access to analytics.readonly scope.
29
38
-`INFLUXDB_TOKEN`: If you want to send API events to InfluxDB, specify this write token.
30
39
-`INFLUXDB_URL`: The URL for your InfluxDB database.
31
40
-`INFLUXDB_ORG`: The organisation string for your InfluxDB API call.
32
41
-`GA_TABLE_ID`: GA table ID (view) to query when looking for organisation usage.
33
-
-`USER_CREATE_PERMISSIONS`: Set the permissions for creating new users, using a comma-separated list of djoser or rest_framework permissions. Use this to turn off public user creation for self-hosting. e.g. `'djoser.permissions.CurrentUserOrAdmin'`. Defaults to `'rest_framework.permissions.AllowAny'`.
34
-
-`ALLOW_REGISTRATION_WITHOUT_INVITE`: Determines whether users can register without an invite. Defaults to True. Set to False or 0 to disable. Note that if disabled, new users must be invited via email.
42
+
-`USER_CREATE_PERMISSIONS`: Set the permissions for creating new users, using a comma-separated list of djoser or
43
+
rest_framework permissions. Use this to turn off public user creation for self-hosting. e.g.
44
+
`'djoser.permissions.CurrentUserOrAdmin'`. Defaults to `'rest_framework.permissions.AllowAny'`.
45
+
-`ALLOW_REGISTRATION_WITHOUT_INVITE`: Determines whether users can register without an invite. Defaults to True. Set to
46
+
False or 0 to disable. Note that if disabled, new users must be invited via email.
35
47
-`PREVENT_SIGNUP`: Determines whether to prevent new signups.
36
48
-`ENABLE_EMAIL_ACTIVATION`: New user registration will go via email activation flow, default False.
49
+
-`OTEL_EXPORTER_OTLP_ENDPOINT`: Base OTLP/HTTP endpoint (e.g. `http://collector:4318`). If unset, OTel is disabled. See
-`OTEL_SERVICE_NAME`: The `service.name` resource attribute attached to all OTel telemetry. Defaults to
52
+
`flagsmith-api`.
53
+
-`OTEL_TRACING_EXCLUDED_URL_PATHS`: Comma-separated URL paths to exclude from OTel tracing (e.g.
54
+
`health/liveness,health/readiness`).
37
55
38
56
## Frontend Environment Variables
39
57
40
58
-`FLAGSMITH_API_URL`: The API to hit for requests. E.g. `https://edge.api.flagsmith.com/api/v1/`
41
-
-`FLAGSMITH_ON_FLAGSMITH_API_KEY`: The Flagsmith environment key we use to manage features - [Flagsmith runs on Flagsmith](/deployment-self-hosting/core-configuration/running-flagsmith-on-flagsmith).
42
-
-`FLAGSMITH_ON_FLAGSMITH_API_URL`: The API URL which the Flagsmith client should communicate with. Flagsmith runs on Flagsmith. E.g. `https://edge.api.flagsmith.com/api/v1/`. If you are self-hosting and using your own Flagsmith instance to manage its own features, you would generally point this to the same domain name as your own Flagsmith instance.
43
-
-`DISABLE_ANALYTICS_FEATURES`: Disables any in-app analytics-related features: API Usage charts, flag analytics. E.g. `DISABLE_ANALYTICS_FEATURES=1`.
44
-
-`ENABLE_FLAG_EVALUATION_ANALYTICS`: Determines if the Flagsmith SDK should send usage analytics. If you want to enable Flag Analytics, set this. E.g. `ENABLE_FLAG_EVALUATION_ANALYTICS=1`.
45
-
-`PROXY_API_URL`: Proxies the API via this application. Set this to the hostname of the API being proxied. Proxies `/api/v1/` through to `PROXY_API_URL`. If you are using this, any setting to `FLAGSMITH_API_URL` will be ignored and the browser will use the frontend node server to send API requests. Do not prepend `api/v1/` - it will be added automatically.
59
+
-`FLAGSMITH_ON_FLAGSMITH_API_KEY`: The Flagsmith environment key we use to manage features -
60
+
[Flagsmith runs on Flagsmith](/deployment-self-hosting/core-configuration/running-flagsmith-on-flagsmith).
61
+
-`FLAGSMITH_ON_FLAGSMITH_API_URL`: The API URL which the Flagsmith client should communicate with. Flagsmith runs on
62
+
Flagsmith. E.g. `https://edge.api.flagsmith.com/api/v1/`. If you are self-hosting and using your own Flagsmith
63
+
instance to manage its own features, you would generally point this to the same domain name as your own Flagsmith
64
+
instance.
65
+
-`DISABLE_ANALYTICS_FEATURES`: Disables any in-app analytics-related features: API Usage charts, flag analytics. E.g.
66
+
`DISABLE_ANALYTICS_FEATURES=1`.
67
+
-`ENABLE_FLAG_EVALUATION_ANALYTICS`: Determines if the Flagsmith SDK should send usage analytics. If you want to enable
68
+
Flag Analytics, set this. E.g. `ENABLE_FLAG_EVALUATION_ANALYTICS=1`.
69
+
-`PROXY_API_URL`: Proxies the API via this application. Set this to the hostname of the API being proxied. Proxies
70
+
`/api/v1/` through to `PROXY_API_URL`. If you are using this, any setting to `FLAGSMITH_API_URL` will be ignored and
71
+
the browser will use the frontend node server to send API requests. Do not prepend `api/v1/` - it will be added
72
+
automatically.
46
73
-`GOOGLE_ANALYTICS_API_KEY`: Google Analytics key to track API usage.
-`FIRST_PROMOTER_ID`: First Promoter ID for checkout affiliates.
49
-
-`ALLOW_SIGNUPS`: **DEPRECATED** in favour of `PREVENT_SIGNUP` in the API. Determines whether to prevent manual signups without invites. Set it to any value to allow signups.
50
-
-`PREVENT_FORGOT_PASSWORD`: Determines whether to prevent forgot password functionality, useful for LDAP/SAML. Set it to any value to prevent forgot password functionality.
76
+
-`ALLOW_SIGNUPS`: **DEPRECATED** in favour of `PREVENT_SIGNUP` in the API. Determines whether to prevent manual signups
77
+
without invites. Set it to any value to allow signups.
78
+
-`PREVENT_FORGOT_PASSWORD`: Determines whether to prevent forgot password functionality, useful for LDAP/SAML. Set it
79
+
to any value to prevent forgot password functionality.
51
80
-`PREVENT_EMAIL_PASSWORD`: Disables email address signup, login and change email functionality.
52
81
-`ENABLE_MAINTENANCE_MODE`: Puts the site into maintenance mode. Set it to any value to enable maintenance.
53
82
-`AMPLITUDE_API_KEY`: The Amplitude key to use for behaviour tracking.
@@ -56,15 +85,23 @@ This page provides a comprehensive reference for all the environment variables y
56
85
-`SENTRY_API_KEY`: Sentry key for error reporting.
57
86
-`ALBACROSS_CLIENT_ID`: Albacross client ID key for behaviour tracking.
58
87
-`BASE_URL`: Used for specifying a base URL path that's ignored during routing if serving from a subdirectory.
59
-
-`USE_SECURE_COOKIES`: Enable/disable the use of secure cookies. If deploying the frontend in a private network without a domain/SSL cert, disable secure cookies to ensure that session token is persisted. Default: true.
60
-
-`COOKIE_SAME_SITE`: Define the value of the SameSite attribute for the session token cookie set by the frontend. Further reading on this value is available [here](https://web.dev/articles/samesite-cookies-explained). Default: 'none'.
88
+
-`USE_SECURE_COOKIES`: Enable/disable the use of secure cookies. If deploying the frontend in a private network without
89
+
a domain/SSL cert, disable secure cookies to ensure that session token is persisted. Default: true.
90
+
-`COOKIE_SAME_SITE`: Define the value of the SameSite attribute for the session token cookie set by the frontend.
91
+
Further reading on this value is available [here](https://web.dev/articles/samesite-cookies-explained). Default:
92
+
'none'.
61
93
62
94
## OAuth configuration
63
95
64
96
### Google OAuth {#oauth-google}
65
97
66
-
To configure Google OAuth, ensure you have set the relevant OAuth client credentials in your deployment platform, and created the **Flagsmith on Flagsmith** flag as described in the [OAuth guide](/administration-and-security/access-control/oauth). This flag controls whether Google SSO is available in your instance.
98
+
To configure Google OAuth, ensure you have set the relevant OAuth client credentials in your deployment platform, and
99
+
created the **Flagsmith on Flagsmith** flag as described in the
100
+
[OAuth guide](/administration-and-security/access-control/oauth). This flag controls whether Google SSO is available in
101
+
your instance.
67
102
68
103
### GitHub OAuth {#oauth-github}
69
104
70
-
To configure GitHub OAuth, ensure you have set `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` in your environment, and created the **Flagsmith on Flagsmith** flag as described in the [OAuth guide](/administration-and-security/access-control/oauth). This enables the GitHub SSO option in your instance.
105
+
To configure GitHub OAuth, ensure you have set `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` in your environment, and
106
+
created the **Flagsmith on Flagsmith** flag as described in the
107
+
[OAuth guide](/administration-and-security/access-control/oauth). This enables the GitHub SSO option in your instance.
0 commit comments