Skip to content

Environment variables

Environment Variables Overview

undb is designed to be used out of the box without the need for any environment variable configuration. However, for advanced customization and integration, you can use environment variables to control various aspects of the system, including logging, database connections, email settings, authentication providers, and storage configurations. Below are tables that detail each environment variable, its purpose, and possible values.

Logging Configuration

Logging configuration determines the verbosity of the application logs.

VariableDescriptionPossible ValuesExample Value
LOG_LEVELControls the verbosity of logs.debug, info, warn, errordebug

Authentication configuration controls user registration and admin account settings.

VariableDescriptionPossible ValuesExample Value
UNDB_DISABLE_REGISTRATIONWhether to disable new user registrationtrue, falsefalse
UNDB_ADMIN_EMAILEmail address for the admin accountN/A[email protected]
UNDB_ADMIN_PASSWORDPassword for the admin accountN/AsecurePassword123

Note: Setting UNDB_DISABLE_REGISTRATION to true will prevent new users from self-registering. This is useful when you want to restrict access or manage user accounts manually. UNDB_ADMIN_EMAIL and UNDB_ADMIN_PASSWORD are used to set up the initial admin account, ensuring there’s an admin login available on first deployment.

Database Configuration

Database configuration sets up the database connection for undb.

VariableDescriptionPossible ValuesExample Value
UNDB_DB_PROVIDERSpecifies the database provider being used.sqlite, tursoturso
UNDB_DB_TURSO_URLThe URL for the Turso database connection, if using turso.N/Alibsql://127.0.0.1:8080?tls=0
UNDB_DB_TURSO_AUTH_TOKENThe authentication token for accessing the Turso database.N/Ayour-auth-token

Note: If UNDB_DB_PROVIDER is set to sqlite, undb will use a local SQLite database. If set to turso, undb will connect to a database hosted on Turso.

Base URL Configuration

Base URL configuration defines the root URL where undb is hosted.

VariableDescriptionExample Value
UNDB_BASE_URLThe base URL where undb is hosted.http://localhost:3721

Email Configuration

Email configuration controls how undb sends emails, including verification emails and notifications.

VariableDescriptionPossible ValuesExample Value
UNDB_MAIL_PROVIDERSpecifies the email provider used for sending emails.nodemailer, mailgunmailgun
UNDB_MAIL_HOSTThe SMTP server host for sending emails (if using nodemailer).N/Alocalhost, email-smtp.us-west-1.amazonaws.com
UNDB_MAIL_PORTThe port for the SMTP server (if using nodemailer).N/A1025, 465
UNDB_MAIL_SECUREEnables secure connection (SSL/TLS) for SMTP (if using nodemailer).true, falsefalse
UNDB_MAIL_USERSMTP server username for authentication (if using nodemailer).N/Ayour-smtp-username
UNDB_MAIL_PASSSMTP server password for authentication (if using nodemailer).N/Ayour-smtp-password
UNDB_MAIL_DEFAULT_FROMThe default email address to use as the sender.N/A[email protected]
UNDB_MAILGUN_API_KEYThe API key for Mailgun (if using mailgun).N/Ayour-mailgun-api-key
UNDB_MAILGUN_DOMAINThe Mailgun domain used for sending emails.N/Amg.undb.io

Note: If UNDB_MAIL_PROVIDER is set to nodemailer, undb will use SMTP for sending emails. If set to mailgun, you need to configure UNDB_MAILGUN_API_KEY and UNDB_MAILGUN_DOMAIN.

Authentication Providers

Authentication providers allow undb to integrate with external identity providers like GitHub and Google for OAuth authentication.

VariableDescriptionExample Value
GITHUB_CLIENT_IDThe client ID for GitHub OAuth authentication.N/A
GITHUB_CLIENT_SECRETThe client secret for GitHub OAuth.N/A
GOOGLE_CLIENT_IDThe client ID for Google OAuth authentication.N/A
GOOGLE_CLIENT_SECRETThe client secret for Google OAuth.N/A

Storage Configuration

Storage configuration determines where undb stores data, such as file uploads.

VariableDescriptionPossible ValuesExample Value
UNDB_STORAGE_PROVIDERSpecifies the storage service provider.local, minio, s3minio
UNDB_STORAGE_PRIVATE_BUCKETThe bucket name for storing private data.N/Aundb-local
UNDB_MINIO_STORAGE_ENDPOINTThe endpoint for the MinIO storage service.N/A127.0.0.1
UNDB_MINIO_STORAGE_PORTThe port for the MinIO storage service.N/A9000
UNDB_MINIO_STORAGE_REGIONThe region setting for MinIO storage.N/Aus-east-1
UNDB_MINIO_STORAGE_USE_SSLWhether to use SSL for MinIO storage connection.true, falsefalse
UNDB_MINIO_STORAGE_ACCESS_KEYThe access key for MinIO storage.N/Ayour-minio-access-key
UNDB_MINIO_STORAGE_SECRET_KEYThe secret key for MinIO storage.N/Ayour-minio-secret-key

Note: If UNDB_STORAGE_PROVIDER is set to local, files will be stored locally on the server. If set to minio, files will be stored on a MinIO server, and if set to s3, they will be stored on an Amazon S3 bucket.