Most configuration is done through environment variables. In the development environment, these are stored in files for ease of editing and loading. In production, they are set as part of the runtime environment.
CTMS_DB_URL- The database connection parameters, formatted as a URL. In the development environment, this defaults to talk to thepostgrescontainer. In production, it is set to talk to the provisioned database.CTMS_DB_POOL_SIZE- The database connection parameterpool_size(default: 10). ...view more on sqlalchemy.CTMS_DB_MAX_OVERFLOW- The database connection parametermax_overflow(default: 20). ...view more on sqlalchemy.CTMS_DB_POOL_TIMEOUT_IN_SECONDS- The database connection parameterpool_timeout(default: 45s). ...view more on sqlalchemy.CTMS_SECRET_KEY- An encryption key, used for OAuth2 and other hashes. Set to a long but non-secret value for development, and set to a randomized string for each production deployment.CTMS_TOKEN_EXPIRATION- How long an OAuth2 access token is valid, in seconds. If unset, defaults to one hour.CTMS_SERVER_PREFIX- The protocol and domain part of the server name, used to construct full URLS. Set tohttp://localhost:8000in development, and the user-facing prefix in production.CTMS_USE_MOZLOG- Use the JSON MozLog format for logs. Defaults toTrueas used in production, and is set toFalsefor development. See the deployment guide for more information on the MozLog format.CTMS_LOGGING_LEVEL- The minimum level for logs. Defaults toINFOif unset. Unset in production, and set toINFOin development.CTMS_LOG_SQLALCHEMY- Determines whether SQLAlchemy logs should be emmited. Defaults toFalseif unset. Unset in production, and set toFalsein development.CTMS_SENTRY_DEBUG- If set to True, then sentry initialization and capture is logged as well. This may be useful for development, but is not recommended for production.CTMS_FASTAPI_ENV- To determine which environment is being run; defaults toNone.CTMS_UID- The user ID of theappaccount, used to run the CTMS application. If unset, defaults to 10001. On Linux development systems, set along withCTMS_GIDto match the development user, for consistent permissions.CTMS_GID- The group ID of theappaccount, used to run the CTMS application. If unset, defaults to 10001. On Linux development systems, set along withCTMS_UIDto match the development user, for consistent permissions.MK_WITH_SERVICE_PORTS- If set to--service-ports, passes that option todocker runcommands, allowing access to host-based commands.MK_KEEP_DOCKER_UP- If unset, thenmake testrunsdocker compose downafter tests run, shutting down the PostgreSQL container. If set to1,make testkeeps containers running.PORT- The port for the web service. Defaults to 8000 if unset.SENTRY_DSN- The Sentry connection string. The sentry-sdk reads this in production. It should be unset in development, except for Sentry testing, and after informing operations engineers.
The file ctms/config.py defines the environment settings for the CTMS API.
In the production environment, environment variables are set in the deployment instances and read by the CTMS API application for configuration. When possible, the default values of environment variables are appropriate for production.
In the local development environment, the default configuration is in .env.
The file .env.example is the .env template for new developer
environments.
.env is loaded in the Makefile, making those configuration items
available in Makefile targets and commands. .env is also loaded by
docker compose and passed to Docker. Some adjust the build process by
setting ARG variables in the Dockerfile. Others are passed to the runtime
environment. The CTMS API application then loads these from the environment.
Linux users should set CTMS_UID and CTMS_GID to match their user account,
so that files created inside the docker container have the same permissions as
their user account.