Skip to main content
This page documents all environment variables used to configure the Document Download Frontend application.

Required Variables

These environment variables must be set for the application to run.
NOTIFY_ENVIRONMENT
string
required
Environment name for the application. Used purely for logging purposes and should not be used for logical conditionals in code.Supported values:
  • development - Loads Development config class
  • test - Loads Test config class
  • Any other value loads the base Config class
Source: app/config.py:16, app/__init__.py:56

API Configuration

API_HOST_NAME
string
Hostname for the Notify API service.Default (Development): http://localhost:6011Default (Test): http://test-notify-apiSource: app/config.py:9, app/config.py:29
DOCUMENT_DOWNLOAD_API_HOST_NAME
string
Public hostname for the Document Download API service.Default (Development): http://localhost:7000Default (Test): https://download.test-doc-download-api.gov.ukSource: app/config.py:20, app/config.py:30
DOCUMENT_DOWNLOAD_API_HOST_NAME_INTERNAL
string
Internal hostname for the Document Download API service. Used for server-to-server communication.Default (Development): Falls back to DOCUMENT_DOWNLOAD_API_HOST_NAME value (http://localhost:7000)Default (Test): https://download.test-doc-download-api-internal.gov.ukSource: app/config.py:21, app/config.py:31-33

Security & Authentication

SECRET_KEY
string
required
Secret key for Flask session signing and CSRF protection.Development default: dev-notify-secret-key
Never use the development default in production. Always set a unique, randomly generated value.
Source: app/config.py:7, app/config.py:36
ADMIN_CLIENT_SECRET
string
required
Secret key for authenticating with the admin client.Development default: dev-notify-secret-key
Never use the development default in production. Always set a unique, randomly generated value.
Source: app/config.py:5, app/config.py:35

Logging

NOTIFY_REQUEST_LOG_LEVEL
string
default:"INFO"
Log level for request logging.Supported values: DEBUG, INFO, WARNING, ERROR, CRITICALSource: app/config.py:18

UI Customization

HEADER_COLOUR
string
default:"#FFBF47"
Hex color code for the application header.Default is #FFBF47 (yellow from GOV.UK design system).Source: app/config.py:23
HTTP_PROTOCOL
string
default:"http"
HTTP protocol to use for generated URLs.Supported values: http, httpsSource: app/config.py:24

Server Configuration

SERVER_NAME
string
Server name for the Flask application. Used for URL generation.Test default: document-download-frontend.govOnly required in specific environments (development and test).Source: app/config.py:28, app/config.py:46
HTTP_SERVE_TIMEOUT_SECONDS
integer
default:"30"
Timeout in seconds for HTTP request serving. Used by both the eventlet middleware and gunicorn.Source: application.py:28, gunicorn_config.py:12

Performance Monitoring (Sentry)

These variables control Sentry error and performance monitoring.
SENTRY_ENABLED
boolean
default:"0"
Enable or disable Sentry monitoring.Set to 1 to enable, 0 to disable.Source: app/performance.py:15
SENTRY_DSN
string
Sentry Data Source Name (DSN) for the project.Required when SENTRY_ENABLED=1.Source: app/performance.py:16
SENTRY_ALLOW_PII
boolean
default:"0"
Allow Sentry to collect Personally Identifiable Information (PII).Set to 1 to enable, 0 to disable.When enabled:
  • send_default_pii is set to True
  • request_bodies is set to medium
Source: app/performance.py:14, app/performance.py:24-25
SENTRY_ERRORS_SAMPLE_RATE
float
default:"0.0"
Sample rate for error events sent to Sentry.Value between 0.0 (0%) and 1.0 (100%).Source: app/performance.py:21
SENTRY_TRACES_SAMPLE_RATE
float
default:"0.0"
Sample rate for performance traces sent to Sentry.Value between 0.0 (0%) and 1.0 (100%).Source: app/performance.py:22

Test Configuration

These variables are used in the Test configuration class.
TESTING
boolean
Enable Flask testing mode.Test default: TrueSource: app/config.py:42
WTF_CSRF_ENABLED
boolean
Enable CSRF protection for Flask-WTF forms.Test default: False (disabled for testing)Source: app/config.py:43

Example Configuration

Development Environment

export NOTIFY_ENVIRONMENT=development
export SECRET_KEY=dev-notify-secret-key
export ADMIN_CLIENT_SECRET=dev-notify-secret-key
export API_HOST_NAME=http://localhost:6011
export DOCUMENT_DOWNLOAD_API_HOST_NAME=http://localhost:7000

Production Environment

export NOTIFY_ENVIRONMENT=production
export SECRET_KEY=<randomly-generated-secret>
export ADMIN_CLIENT_SECRET=<randomly-generated-secret>
export API_HOST_NAME=https://api.notifications.service.gov.uk
export DOCUMENT_DOWNLOAD_API_HOST_NAME=https://download.notifications.service.gov.uk
export DOCUMENT_DOWNLOAD_API_HOST_NAME_INTERNAL=https://download-internal.notifications.service.gov.uk
export HTTP_PROTOCOL=https
export NOTIFY_REQUEST_LOG_LEVEL=WARNING
export HTTP_SERVE_TIMEOUT_SECONDS=60

# Sentry monitoring
export SENTRY_ENABLED=1
export SENTRY_DSN=https://your-sentry-dsn@sentry.io/project-id
export SENTRY_ERRORS_SAMPLE_RATE=1.0
export SENTRY_TRACES_SAMPLE_RATE=0.1

Build docs developers (and LLMs) love