Skip to content

Configuration

For API configuration and settings we use Pydantic Settings module.

The configuration is loaded from environment variable and can be saved in .env file for persistance.

Interactive Configuration Wizard

For the convenience you can run interactive configuration wizard by running:

$ unipoll-api setup

Configuration Variables

Variables Description Default
ADMIN_EMAIL Email of the administrator of the application admin@example.com
MONGODB_URL URL of the MongoDB database used by the application mongodb://localhost:27017
SECRET_KEY Secrete key used for Authentication and Authorization secret
ORIGINS List of allowed origins for CORS *
HOST IP address to bind to 0.0.0.0
PORT Port to bind to 9000
RELOAD Enable auto-reload True

Additional Info

Host - IP address to bind to. Only IPv4 is supported for now.

Origins - List of allowed origins for CORS. The connections from other origins will be rejected. You can specify multiple origins by separating them with comma. For example: http://localhost:3000,http://localhost:3001 or use * to allow all origins.

Reload - Enable auto-reload. This is useful for development. For production you should disable auto-reload. The reload will restart the server when any of the source files are changed.