Skip to content

Settings

madbot is configured with environment variables. This page describes every variable that the API and the client read, grouped by theme. For each one it gives:

  • Read by: the component that reads it. The API, the Celery workers and Celery Beat load the same settings, so the API variables apply to all three: give them the same values.
  • Required: whether madbot starts or works without it.
  • Default: the value used when the variable is not set. It comes from the code, not from .env.example, whose values suit a development checkout.

The settings of each plugin are described in the documentation of the plugin.

The API reads, in this order, the file named by MADBOT_ENV_PATH, api/.env next to the code, then /etc/madbot/madbot.env. A variable already set in the environment of the process wins over the files, and the first file that sets a variable wins over the next ones. api/.env.example lists every variable and explains the syntax the file must follow: it is read by Django, by the shell and by docker compose.

The client reads client/.env when it is started with pnpm dev and when it is built with pnpm build: the built client keeps the values it found there. The built server (node .output/server/index.mjs) does not read the file, so after changing it, build the client again and restart the service that runs it. A variable set in the environment of that service wins over the value kept at build, without building again, but only for a variable the client knew at build: one that has a default, or that client/.env set, even empty, when the client was built. client/.env.example lists its variables.

A merge request that makes the API or the client read a new variable must add it to the .env.example of its component and to this page: the Settings reference job of the CI fails otherwise, and names the variable.

Signs the sessions, the tokens and the links that madbot sends by email. The API and the Celery workers must share the same value, or the tokens signed by one are rejected by the other. Changing it signs every user out and invalidates the links already sent. Keep it secret.

Give it a random value of at least 50 characters. Generate it with:

Terminal window
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

Wrap it in single quotes in the file: it may contain a $ or a #. If it starts with $, generate another one: the API reads a value that starts with $ as the name of another variable, even in quotes, and refuses to start.

  • Read by: API, workers
  • Required: yes. madbot refuses to start when it is empty or a placeholder such as changeme.
  • Default: none

The host names the API answers to, separated by commas. A request for another host gets a 400 error.

  • Read by: API
  • Required: yes, unless the API is only reached as localhost
  • Default: localhost

The public address of the API, as host:port without the scheme. madbot builds the links of its emails from it, with https unless the host is localhost or 127.0.0.1.

  • Read by: API, workers
  • Required: yes when DEBUG is off: the links of the emails are broken without it
  • Default: localhost:8000 when DEBUG is on, empty otherwise

The origins (scheme, host and port) of the web pages allowed to call the API from a browser, separated by commas. The origin of the client must be one of them.

  • Read by: API
  • Required: yes, unless the client runs on localhost:3000 or 127.0.0.1:3000
  • Default: http://localhost:3000,http://127.0.0.1:3000

The origins trusted for the requests that change data with a session cookie, separated by commas. Give it the same origins as CORS_ALLOWED_ORIGINS.

  • Read by: API
  • Required: yes, since the client and the API do not share an origin
  • Default: empty

Takes the host of a request from the X-Forwarded-Host header set by a reverse proxy rather than from the Host header. Turn it on only when a reverse proxy in front of the API sets that header.

  • Read by: API
  • Required: no
  • Default: false

The header, and its value, by which a reverse proxy tells the API that the request came over HTTPS, as HEADER,value, such as HTTP_X_FORWARDED_PROTO,https. Without it, an API behind a proxy that terminates TLS believes every request came over HTTP. Set it only when the proxy sets that header and removes it from the incoming requests: otherwise any client can claim HTTPS.

  • Read by: API
  • Required: no
  • Default: empty

The folder where madbot collectstatic gathers the static files of the API (administration, sign-in pages), for the web server to serve them.

  • Read by: API
  • Required: no
  • Default: .static, relative to the folder the API runs from

The path of an extra settings file, read before api/.env and /etc/madbot/madbot.env. It must be set in the environment of the process, not in a settings file.

  • Read by: API, workers
  • Required: no
  • Default: empty, no extra file

Turns on Django’s debug mode: detailed error pages, the debug logs on the console, and the automatic restart of the Celery worker when the code changes. The debug pages show the settings and the code to anyone who triggers an error: never turn it on for an instance others can reach.

  • Read by: API, workers
  • Required: no
  • Default: false

The folder of the log files: django.log, error.log and celery.log, rotated every night and kept 10 days. The API and the workers must be able to write in it.

  • Read by: API, workers
  • Required: no
  • Default: log, in the folder of the API code

Turns on Silk, which records every request and its SQL queries to profile the API. It slows every request down and stores their content in the database. See Performance and debugging.

  • Read by: API
  • Required: no
  • Default: false

The folder of the JUnit report written by pixi run test-cov-junit, which the CI publishes as the test report of a pipeline.

  • Read by: the tests
  • Required: no
  • Default: test-reports

The database, as a URL, such as postgres://<user>:<password>@<host>:5432/<database> for PostgreSQL. SQLite allows only one writer at a time: it suits a development checkout, not an instance with several users.

  • Read by: API, workers
  • Required: no
  • Default: an SQLite file, db.sqlite3 in the folder of the API code

The host of Redis, which carries the Celery tasks, the cache and the real-time notifications.

  • Read by: API, workers
  • Required: yes when Redis does not run on the same machine
  • Default: localhost

The port of Redis.

  • Read by: API, workers
  • Required: no
  • Default: 6379

madbot keeps the credentials of the connections in Vault, not in its database. The API signs in to Vault with an AppRole.

The address of Vault, with its scheme and port.

  • Read by: API, workers
  • Required: yes
  • Default: empty

The mount point of the key-value secrets engine that holds the credentials.

  • Read by: API, workers
  • Required: yes
  • Default: empty

The role ID of the AppRole of madbot. Read it from Vault with vault read auth/approle/role/<role>/role-id.

  • Read by: API, workers
  • Required: yes
  • Default: empty

The secret ID of the AppRole of madbot. Generate it in Vault with vault write -f auth/approle/role/<role>/secret-id. Keep it secret.

  • Read by: API, workers
  • Required: yes
  • Default: empty

The RSA private key with which madbot signs the OpenID Connect tokens it gives to the client. Changing it invalidates the tokens already given. Keep it secret.

It is a 4096-bit key, on a single line where \n stands for each line break. Generate it and turn it into a single line with the commands below, then delete oidc.key:

Terminal window
openssl genrsa -out oidc.key 4096
awk -v ORS='\\n' '1' oidc.key
  • Read by: API
  • Required: yes
  • Default: empty

How long a refresh token stays valid, in seconds. The periodic clean-up of the tokens deletes the expired ones.

  • Read by: API, workers
  • Required: no
  • Default: 604800 (7 days)

Whether a new user must confirm their email address: mandatory (they cannot sign in before), optional (an email is sent, but not required) or none.

  • Read by: API
  • Required: no
  • Default: mandatory

Whether an administrator must approve a new account before it can sign in.

  • Read by: API
  • Required: no
  • Default: true

Marks every new account as approved when it is created, which skips the approval of ACCOUNT_ADMIN_APPROVEMENT.

  • Read by: API
  • Required: no
  • Default: false

Emails a user when their password, their email addresses or their linked accounts change.

  • Read by: API
  • Required: no
  • Default: true

The scheme of the links in the account emails (email confirmation, password reset): http or https.

  • Read by: API
  • Required: yes when the API is served over HTTPS
  • Default: http

Where the sign-in pages of the API send the user once signed in, when no other page was asked. The client always asks for a page, so it rarely needs to be set.

  • Read by: API
  • Required: no
  • Default: Django’s default, /accounts/profile/

The address of the link back to madbot on the profile page of the API, usually the address of the client.

  • Read by: API
  • Required: no
  • Default: empty, the address of the API itself

Offers to sign in with ORCID. Register madbot as an application in the developer tools of ORCID to get the values below.

  • Read by: API
  • Required: no
  • Default: false

The client ID of the madbot application at ORCID, given when you register the application.

  • Read by: API
  • Required: yes when ENABLE_ORCID_AUTH is on; the API does not start without it
  • Default: none

The client secret of the madbot application at ORCID, given when you register the application. Keep it secret.

  • Read by: API
  • Required: yes when ENABLE_ORCID_AUTH is on; the API does not start without it
  • Default: none

The domain of ORCID to use: orcid.org for the registry, sandbox.orcid.org for its sandbox.

  • Read by: API
  • Required: yes when ENABLE_ORCID_AUTH is on; the API does not start without it
  • Default: none

Offers to sign in with a GitLab account. Register madbot as an application in GitLab to get the values below.

  • Read by: API
  • Required: no
  • Default: false

The application ID of the madbot application in GitLab, given when you register the application.

  • Read by: API
  • Required: yes when ENABLE_GITLAB_AUTH is on
  • Default: empty

The secret of the madbot application in GitLab, given when you register the application. Keep it secret.

  • Read by: API
  • Required: yes when ENABLE_GITLAB_AUTH is on
  • Default: empty

Offers to sign in with an external OpenID Connect provider, such as the identity federation of your institution. Register madbot as a client of the provider to get the values below.

  • Read by: API
  • Required: no
  • Default: false

The identifier of the provider in madbot. It is part of the callback address to register at the provider: <API address>/accounts/oidc/<provider id>/login/callback/.

  • Read by: API
  • Required: no
  • Default: oidc

The name of the provider shown on the sign-in page.

  • Read by: API
  • Required: yes when ENABLE_OIDC_AUTH is on
  • Default: none

The client ID of madbot at the provider, given by the provider.

  • Read by: API
  • Required: yes when ENABLE_OIDC_AUTH is on
  • Default: empty

The client secret of madbot at the provider, given by the provider. Keep it secret.

  • Read by: API
  • Required: yes when ENABLE_OIDC_AUTH is on
  • Default: empty

The address of the provider’s server, from which madbot reads its OpenID configuration. The provider gives it.

  • Read by: API
  • Required: yes when ENABLE_OIDC_AUTH is on
  • Default: empty

Without EMAIL_HOST, and without USE_MAILHOG in development, madbot sends no email: it writes them as files in the sent_emails folder of the API code. Account confirmations, invitations and notifications then never reach anyone.

The SMTP server that sends the emails.

  • Read by: API, workers
  • Required: yes for the emails to reach their recipients
  • Default: none, the emails are written to files

The port of the SMTP server, usually 587 with EMAIL_USE_TLS and 465 with EMAIL_USE_SSL. Ignored when emails go to files, and replaced by MAILHOG_PORT when they go to MailHog.

  • Read by: API, workers
  • Required: no, but set it when EMAIL_HOST is set
  • Default: none: the connection then uses port 25, or 465 with EMAIL_USE_SSL

The user name on the SMTP server.

  • Read by: API, workers
  • Required: when the server asks for it
  • Default: empty, no authentication

The password on the SMTP server. Keep it secret.

  • Read by: API, workers
  • Required: when the server asks for it
  • Default: empty

Starts TLS on the connection to the SMTP server (STARTTLS), usually on port 587. Only read when EMAIL_HOST is set, ignored when emails go to files or to MailHog. Do not turn it on together with EMAIL_USE_SSL.

  • Read by: API, workers
  • Required: no
  • Default: true

Opens the connection to the SMTP server over TLS from the start, usually on port 465. Only read when EMAIL_HOST is set, ignored when emails go to files or to MailHog. Do not turn it on together with EMAIL_USE_TLS.

  • Read by: API, workers
  • Required: no
  • Default: false

The sender of the emails sent to users, as an address or as Name <address>. The SMTP server must accept to send from this address.

  • Read by: API, workers
  • Required: yes for the emails to come from an address of the instance
  • Default: from@example.com

The sender of the error reports sent to the administrators.

  • Read by: API, workers
  • Required: no
  • Default: the value of DEFAULT_FROM_EMAIL

The address users can write to for help. madbot shows it in its pages and emails, so it must be a mailbox that someone of the team running the instance reads.

  • Read by: API, workers
  • Required: yes for users to reach the team
  • Default: support@example.com

The addresses that receive the error reports, separated by commas, when they are not the support address.

  • Read by: API, workers
  • Required: no
  • Default: the value of MADBOT_SUPPORT_EMAIL

Sends the emails to MailHog, a local SMTP server that shows them in a web page instead of delivering them, to see the emails of a development checkout. Only applies when DEBUG is on, and then wins over EMAIL_HOST.

  • Read by: API, workers
  • Required: no
  • Default: false

The host of MailHog, when USE_MAILHOG is on.

  • Read by: API, workers
  • Required: no
  • Default: localhost

The SMTP port of MailHog, when USE_MAILHOG is on.

  • Read by: API, workers
  • Required: no
  • Default: 1025

The address of the terms of use of the instance, which a person accepts when creating an account. madbot does not ship terms of use: the team running the instance writes them and publishes them where it chooses.

  • Read by: API
  • Required: yes for the sign-up form to link to real terms; when empty, its link leads back to the form
  • Default: empty

The address of the privacy notice of the instance, which a person accepts when creating an account. As for the terms of use, madbot does not ship one: the team running the instance writes it and publishes it.

  • Read by: API
  • Required: yes for the sign-up form to link to a real notice; when empty, its link leads back to the form
  • Default: empty

Turns on the global workspace search, backed by Meilisearch. When off, no indexing task runs, /api/search answers 503 and the client hides the search. After turning it on, run madbot rebuild_search_index: nothing written while it was off is indexed. See Enable the global search.

  • Read by: API, workers
  • Required: no
  • Default: false

The address of Meilisearch. Only the API and the workers need to reach it.

  • Read by: API, workers
  • Required: yes when SEARCH_ENABLED is on
  • Default: http://localhost:7700

The key the API uses with Meilisearch. Use a key limited to the workspace_search index rather than the master key: Restrict the API key explains how to create it. Keep it secret.

  • Read by: API, workers
  • Required: yes when SEARCH_ENABLED is on
  • Default: empty

The number of results asked of the plugin per page, when a user searches in a data source.

  • Read by: API
  • Required: no
  • Default: 20

The shortest search in a data source that the API accepts, in characters.

  • Read by: API
  • Required: no
  • Default: 3

The longest search in a data source that the API accepts, in characters.

  • Read by: API
  • Required: no
  • Default: 200

The largest number of data a single batch of datalinks may create. The batch creates one row per data and returns them all in its answer.

  • Read by: API
  • Required: no
  • Default: 1000

The largest number of samples a single batch may create. A batch is created in one request and one transaction.

  • Read by: API
  • Required: no
  • Default: 1000

The largest number of files (names and datalinks) a single batch of samples may name. Each kind of file is read in one query, and the databases limit the number of values a query holds: keep it under 32766 on SQLite and 65535 on PostgreSQL.

  • Read by: API
  • Required: no
  • Default: 10000

How long the figures of the analytics endpoints stay in the cache, in seconds.

  • Read by: API
  • Required: no
  • Default: 3600 (1 hour)

The Python packages of the plugins the instance loads, separated by commas, such as madbot_sshfs,madbot_zenodo. Install each plugin first, then run madbot reload_plugins.

  • Read by: API, workers
  • Required: no, but madbot reaches no data source without plugins
  • Default: empty

The folder where pixi run install-plugins clones the plugins in editable mode, to work on them from a development checkout. It is relative to the folder that holds the madbot checkout.

  • Read by: pixi run install-plugins
  • Required: no
  • Default: madbot-plugins

Imports plugins_api from a local checkout of plugin_api/ instead of the released package. For developers working on plugins_api itself. pixi reads it when the environment is activated: a change applies from the next pixi run or pixi shell.

  • Read by: pixi, madbot list_plugins
  • Required: no
  • Default: false

The local checkout of plugin_api/ imported when MADBOT_PLUGIN_API_LOCAL is on, relative to the folder that holds the madbot checkout.

  • Read by: pixi
  • Required: no
  • Default: plugin_api

The user name of the basic authentication of Flower, the monitoring interface of Celery, set in the Celery configuration.

  • Read by: API, workers
  • Required: when Flower runs
  • Default: empty

The password of the basic authentication of Flower, such as the output of openssl rand -base64 32. Keep it secret.

  • Read by: API, workers
  • Required: when Flower runs
  • Default: empty

The client reads these variables when it starts. Restart it after changing one.

Encrypts the session cookie of the client. Changing it signs every user out. Keep it secret.

Give it a random value of at least 32 characters. Generate it with:

Terminal window
openssl rand -base64 48 | tr -dc 'A-Za-z0-9' | head -c 32; echo
  • Read by: client server
  • Required: yes
  • Default: none

The client signs users in through the API, which acts as its OpenID Connect provider. Register the client as an application of the API with madbot createapplication, as in Create the database, with the callback address <client address>/api/auth/callback/madbot.

The address of the API, as the browser of the users reaches it.

  • Read by: client, sent to the browser
  • Required: yes
  • Default: none

The address of the OpenID configuration of the API: <API address>/o/.well-known/openid-configuration/.

  • Read by: client server
  • Required: yes
  • Default: none

The client ID of the application registered in the API for the client: the --client-id given to madbot createapplication.

  • Read by: client, sent to the browser
  • Required: yes
  • Default: none

The client secret of the application registered in the API for the client: the --client-secret given to madbot createapplication. On an instance others can reach, use a random value, such as the output of openssl rand -base64 32, rather than the madbot of the development guide. Keep it secret.

  • Read by: client server
  • Required: yes
  • Default: none

The port the client server listens on.

  • Read by: client server
  • Required: no
  • Default: 3000

The public address of the authentication routes of the client: its address followed by /api/auth.

  • Read by: client server
  • Required: yes, unless the client runs on http://localhost:3000
  • Default: none

The same address as AUTH_ORIGIN, from which the sign-in builds its callback address. Without it, the sign-in returns to http://localhost:3000.

  • Read by: client server
  • Required: yes, unless the client runs on http://localhost:3000
  • Default: none

The page users land on after signing out, such as the presentation site of the instance.

  • Read by: client, sent to the browser
  • Required: no
  • Default: none, the sign-in page of the client

The support address of the instance, linked from the user menu as “Contact support”. Must be an https address (http only on a local host). Leave empty for no link.

  • Read by: client, sent to the browser
  • Required: no
  • Default: none, the support link is hidden