Skip to content

Configuration reference

dmsforall reads its configuration from environment variables. The API validates them at start-up with zod and refuses to start if one is invalid. The error message lists every faulty variable.

In development, the variables are read from the .env file at the root of the repository. In the default stack, the API reads its variables from the Compose file, which takes its values from .env. Use .env.example as the list of settings.

Booleans take the values true or false. Durations are in minutes, seconds or milliseconds, as written in each name.

VariableDefaultEffect
NODE_ENVdevelopmentdevelopment, test or production. Production enables stricter checks and the real e-mail sending.
MODE_PROCESSUScombineapi serves HTTP only. worker runs the background jobs only. combine does both.
PORT3000Port the API listens on, from 1 to 65535.
API_URL_PUBLIQUErequiredPublic URL of the API, for example https://api.garage.example.org.
WEB_URL_PUBLIQUErequiredPublic URL of the web interface.
LOG_NIVEAUinfoLog level: fatal, error, warn, info, debug or trace.
OPENAPI_EXPOSER_DOCSfalsePublish the API documentation at /api/docs. Keep it false in production.
VariableDefaultEffect
DATABASE_URLrequiredPostgreSQL URL for the role dfa_app. This is the role the API uses, and it is subject to row-level security. Must start with postgres.
DATABASE_URL_MIGRATIONrequiredPostgreSQL URL for the role dfa_migrator, used only to apply migrations. Must differ from DATABASE_URL.
DATABASE_POOL_MAX10Maximum number of connections in the pool, from 1 to 50.
DATABASE_POOL_MINmin(2, DATABASE_POOL_MAX)Connections kept open even when idle. Cannot exceed DATABASE_POOL_MAX.
DATABASE_TIMEOUT_REQUETE_MS10000Maximum time for one query, in milliseconds.
DATABASE_TIMEOUT_CONNEXION_MS5000Maximum time to open a connection, in milliseconds.
DATABASE_TIMEOUT_IDLE_MS30000Time before an idle connection above the minimum is closed, in milliseconds.
VariableDefaultEffect
REDIS_URLrequiredRedis URL. Must start with redis. Used for queues, real-time events and rate limits.
VariableDefaultEffect
SESSION_COOKIE_NOMdfa_sessionName of the session cookie. Letters, digits, _ and - only.
SESSION_DUREE_MINUTES480Maximum session length, from 5 to 43200 minutes.
SESSION_INACTIVITE_MINUTES120Session closes after this idle time, from 5 to 1440 minutes.
COOKIE_DOMAINEnoneDomain of the session cookie. Leave empty to use the host of the API.
COOKIE_SECUREtrueMark the cookie Secure. Must be true in production.
TRUST_PROXY_HOPS0Number of reverse proxies in front of the API, from 0 to 10. Set it to the exact number.
ARGON2_MEMOIRE_KIB19456Memory cost of the password hash, in KiB. Minimum 19456.
ARGON2_ITERATIONS2Time cost of the password hash. Minimum 2.
ARGON2_PARALLELISME1Parallelism of the password hash.
LIMITE_CONNEXION_IP20Sign-in attempts allowed per IP address in the window.
LIMITE_CONNEXION_COMPTE15Sign-in attempts allowed per account in the window. Must be greater than SEUIL_VERROUILLAGE_COMPTE.
LIMITE_FENETRE_SECONDES900Length of the sign-in window, in seconds. Minimum 30.
SEUIL_VERROUILLAGE_COMPTE5Failed passwords in a row before the account is locked for a while.
LIMITE_RECHERCHE_UTILISATEUR40Search requests allowed per user in the window.
LIMITE_RECHERCHE_FENETRE_SECONDES30Length of the search window, in seconds.

E-mail is sent for real only when NODE_ENV=production and COURRIEL_ENVOI_REEL=true. In every other case, messages are captured and not delivered.

VariableDefaultEffect
COURRIEL_ENVOI_REELfalseAllow real sending, together with NODE_ENV=production.
SMTP_HOTEnoneSMTP server host name.
SMTP_PORT587SMTP port, from 1 to 65535.
SMTP_SECURISEfalsetrue for implicit TLS. Leave false for STARTTLS on port 587.
SMTP_UTILISATEURnoneSMTP user name.
SMTP_MOT_DE_PASSEnoneSMTP password.
SMTP_EXPEDITEURnoneSender address. Must be a valid e-mail address.
VariableDefaultEffect
SENTRY_DSNnoneDSN of a Sentry-compatible server. When empty, error reporting is off.
SENTRY_ENVIRONMENTNODE_ENVEnvironment name shown in the error reports.
SENTRY_TAUX_ECHANTILLONNAGE_TRACES0Share of requests traced for performance, from 0 to 1.
VERSION_APPcomputedVersion shown in the health endpoint and in logs. Computed from the Git tag when empty.
VERSION_APP_BRANCHEcomputedBranch or tag that produced the build. Computed when empty.

The console is off unless DATABASE_URL_CONSOLE is set.

VariableDefaultEffect
DATABASE_URL_CONSOLEnonePostgreSQL URL for the role dfa_console. Setting it turns the console on.
CONSOLE_COOKIE_NOMdfa_console_sessionName of the console session cookie.
CONSOLE_SESSION_DUREE_MINUTES60Maximum console session length, from 5 to 240 minutes.
CONSOLE_SESSION_INACTIVITE_MINUTES15Console idle timeout, from 1 to 120 minutes.
CONSOLE_POOL_MAX2Connections in the console pool, from 1 to 10.

Each scheduled job has an on/off switch and a cron expression. The cron expressions use UTC.

The switch accepts three states. When the variable is empty, the job is active in production and inactive in other environments. true forces it on, false forces it off.

VariableDefaultJob
REFERENTIEL_VEHICULES_CH_JOB_ACTIFemptyDaily update of the Swiss vehicle reference data.
REFERENTIEL_VEHICULES_CH_JOB_CRON17 4 * * *Schedule of the vehicle reference update.
POINTAGE_CLOTURE_AUTOMATIQUE_JOB_ACTIFemptyAutomatic closing of the time clocking day.
POINTAGE_CLOTURE_AUTOMATIQUE_JOB_CRON30 0 * * *Schedule of the closing job.
RELANCES_FACTURE_JOB_ACTIFemptyPlanning and sending of invoice reminders.
RELANCES_FACTURE_JOB_CRON12 * * * *Schedule of the reminder job.
RESILIATION_PURGE_AUTOMATIQUE_JOB_ACTIFemptyAutomatic purge of a tenant’s data after it leaves the service.
RESILIATION_PURGE_AUTOMATIQUE_JOB_CRON17 3 * * *Schedule of the purge job.
VariableDefaultEffect
OCR_SERVICE_URLhttp://ocr-permis:8092URL of the OCR service that reads vehicle registration documents.
OCR_SERVICE_TIMEOUT_MS20000Time to wait for the vehicle OCR service, in milliseconds. Minimum 1000.
LIMITE_OCR_PERMIS_UTILISATEUR15Vehicle OCR scans allowed per user in the window.
LIMITE_OCR_PERMIS_FENETRE_SECONDES300Length of the vehicle OCR window, in seconds.
FACTURES_FOURNISSEUR_OCR_SERVICE_URLnoneURL of the OCR service that reads supplier invoices. Unset means the feature is not available.
FACTURES_FOURNISSEUR_OCR_TIMEOUT_MS20000Time to wait for the supplier invoice OCR service, in milliseconds. Minimum 1000.
VariableDefaultEffect
VITE_DFA_VERSION_INFOnoneBuild-time text shown in the version footer of the interface. Set at build time, not at run time.

These variables are read by the Compose file, not by the API. Set them in .env.

VariableDefaultEffect
DFA_VERSIONlatestImage tag to run: X.Y.Z, X.Y, latest or edge.
DFA_SITE_ADDRESShttp://localhostSite address. A domain name turns on HTTPS through Caddy.
DFA_PUBLIC_URLhttp://localhost:8080Public address of the site, used as API_URL_PUBLIQUE and WEB_URL_PUBLIQUE.
DFA_HTTP_PORT8080Host port for HTTP.
DFA_HTTPS_PORT8443Host port for HTTPS.
DFA_TRUST_PROXY_HOPS1Passed as TRUST_PROXY_HOPS.
DFA_LOG_LEVELinfoPassed as LOG_NIVEAU.
DFA_EXPOSE_API_DOCSfalsePassed as OPENAPI_EXPOSER_DOCS.
DFA_SENTRY_DSNemptyPassed as SENTRY_DSN.
DFA_SMTP_ENABLEDfalsePassed as COURRIEL_ENVOI_REEL.
DFA_SMTP_HOST, DFA_SMTP_PORT, DFA_SMTP_SECURE, DFA_SMTP_USER, DFA_SMTP_PASSWORD, DFA_SMTP_FROMsee .env.examplePassed as the SMTP_* variables.
DFA_TIMEZONEUTCTime zone of the backup service.
AGE_CLE_PUBLIQUEemptyage public key for the backup profile.
HEURE_SAUVEGARDE03:15Hour of the nightly backup.
SEUIL_TAILLE_MIN_POURCENT50Minimum size of a backup, in percent of the previous one.