Environment configuration reference¶
Open Personen can be ran both as a Docker container or directly on a VPS or dedicated server. It relies on other services, such as database and cache backends, which can be configured through environment variables.
Available environment variables¶
Required settings¶
DJANGO_SETTINGS_MODULE
: which environment settings to use. Available options: -openpersonen.conf.docker
-openpersonen.conf.dev
-openpersonen.conf.ci
SECRET_KEY
: secret key that’s used for certain cryptographic utilities. You should generate one via [miniwebtool](https://www.miniwebtool.com/django-secret-key-generator/)ALLOWED_HOSTS
: A comma separated (without spaces!) list of domains that serve the installation. Used to protect againstHost
header attacks. Defaults to*
for thedocker
environment and defaults to127.0.0.1,localhost
for thedev
environment.
Core settings¶
OPENPERSONEN_BACKEND
: The data source to use for obtaining person data. Can be any of the values below:openpersonen.contrib.demo.backend.default
(default)openpersonen.contrib.stufbg.backend.default
OPENPERSONEN_USE_AUTHENTICATION
: Require an API-token to access the API. Defaults toTrue
.
Database settings¶
DB_HOST
: Hostname of the PostgreSQL database. Defaults todb
for thedocker
environment, otherwise defaults tolocalhost
.DB_USER
: Username of the database user. Defaults toopenpersonen
,DB_PASSWORD
: Password of the database user. Defaults toopenpersonen
,DB_NAME
: Name of the PostgreSQL database. Defaults toopenpersonen
,DB_PORT
: Port number of the database. Defaults to5432
.
Other settings¶
ADMINS
: Comma seperated list (without spaces!) of e-mail addresses to sent an email in the case of any errors. Defaults to an empty list.SITE_ID
: The database ID of the site object. Defaults to1
.DEBUG
: Used for more traceback information on development environment. Various other security settings are derived from this setting! Defaults toTrue
for thedev
environment, otherwise defaults toFalse
.IS_HTTPS
: Used to construct absolute URLs and controls a variety of security settings. Defaults to the inverse ofDEBUG
.SUBPATH
: If hosted on a subpath, provide the value here. If you provide/gateway
, Open Personen assumes its running at the base URL:https://somedomain/gateway/
. Defaults to an empty string.SENTRY_DSN
: URL of the sentry project to send error reports to. Defaults to an empty string (ie. no monitoring).
Specifying the environment variables¶
There are two strategies to specify the environment variables:
provide them in a
.env
filestart the Open Personen processes (with uwsgi/gunicorn/celery) in a process manager that defines the environment variables
Providing a .env file¶
This is the most simple setup and easiest to debug. The .env
file must be
at the root of the project - i.e. on the same level as the src
directory (
NOT in the src
directory).
The syntax is key-value:
SOME_VAR=some_value
OTHER_VAR="quoted_value"
Provide the envvars via the process manager¶
If you use a process manager (such as supervisor/systemd), use their techniques to define the envvars. The Open Personen implementation will pick them up out of the box.