Configuring an environment¶
Most app configuration is controlled via environment variables.
Where to configure values¶
- For local development, values are set in
docker-compose.ymland.env. - For deployed environments, values are managed in
ds-infrastructure-web.
For the full, maintained variable table and defaults, see README.md.
How settings modules are selected¶
- The Docker image defaults
DJANGO_SETTINGS_MODULEtoconfig.settings.production. - Local
docker-compose.ymloverrides this toconfig.settings.develop.
The settings modules are in config/settings/ and develop/staging inherit from production.
Minimum required variables¶
At minimum, each environment should provide:
SECRET_KEY(required and non-empty)DATABASE_HOST,DATABASE_NAME,DATABASE_USER,DATABASE_PASSWORD(and optionalDATABASE_PORT)ROSETTA_API_URL
You will also usually set:
ENVIRONMENT_NAMEALLOWED_HOSTSWAGTAILADMIN_BASE_URL,WAGTAILAPI_BASE_URL,WAGTAILAPI_MEDIA_BASE_URLCSRF_TRUSTED_ORIGINS
Operational recommendations¶
- Use unique
SECRET_KEYvalues per environment. - Keep secrets out of source control.
- Review cache settings (
REDIS_URL,CACHE_DEFAULT_TIMEOUT) when enabling Redis. - Review telemetry settings (
SENTRY_DSN,SENTRY_SAMPLE_RATE) per environment.