Skip to main content

Configuration Reference

Complete reference for all configuration options in Agam Space. Each option can be set via environment variables or config file.

This page shows both configuration methods side-by-side. Use environment

variables for Docker deployments, or config file for advanced setups. :::

Required Variables

These must be set for Agam Space to run:

Environment VariableConfig File PropertyDescriptionExample
DATABASE_HOSTdatabase.hostPostgreSQL database hostnamepostgres
DATABASE_USERNAMEdatabase.usernameDatabase userpostgres
DATABASE_PASSWORDdatabase.passwordDatabase passwordyour_secure_password

Server Configuration

Environment VariableConfig File PropertyDefaultDescription
HTTP_PORTserver.port3331Port the server listens on
HTTP_HOSTserver.host0.0.0.0Host address to bind to
NODE_ENVserver.nodeEnvproductionEnvironment mode (production, development, test)
API_PREFIXserver.apiPrefixapi/v1API endpoint prefix

Database Configuration

Environment VariableConfig File PropertyDefaultDescription
DATABASE_HOSTdatabase.hostrequiredDatabase hostname
DATABASE_PORTdatabase.port5432Database port
DATABASE_USERNAMEdatabase.usernamerequiredDatabase username
DATABASE_PASSWORDdatabase.passwordrequiredDatabase password
DATABASE_NAMEdatabase.databaseagam_spaceDatabase name
DATABASE_SSLdatabase.sslfalseEnable SSL connection
DATABASE_MAX_CONNECTIONSdatabase.maxConnections100Maximum database connections
DATABASE_CONNECTION_TIMEOUTdatabase.connectionTimeout30000Connection timeout (milliseconds)

CORS Configuration

Environment VariableConfig File PropertyDefaultDescription
CORS_ORIGINcors.origin*Allowed origins (comma-separated or *)
CORS_CREDENTIALScors.credentialstrueAllow credentials in CORS requests
Production CORS In production, set CORS_ORIGIN to your specific

domain instead of *:

# Environment variable
CORS_ORIGIN=https://files.yourdomain.com

# Config file
"cors": { "origin": "https://files.yourdomain.com" }

Account & User Management

Environment VariableConfig File PropertyDefaultDescription
ALLOW_NEW_SIGNUPaccount.allowNewSignuptrueAllow new user registration
DEFAULT_USER_STORAGE_QUOTAaccount.defaultUserStorageQuota10000000000Default storage quota per user (bytes) - 10GB

Storage quota examples:

  • 5GB: 5000000000
  • 10GB: 10000000000 (default)
  • 50GB: 50000000000
  • 100GB: 100000000000

File Storage Configuration

Environment VariableConfig File PropertyDefaultDescription
DATA_DIRdirectories.dataDir/dataRoot data directory
FILES_DIRdirectories.filesDir${DATA_DIR}/filesFile storage directory
CONFIG_DIRdirectories.configDir${DATA_DIR}/configConfiguration directory
LOG_DIRdirectories.logDir${DATA_DIR}/logsLogs directory
CACHE_DIRdirectories.cacheDir${DATA_DIR}/cacheCache directory
MAX_FILE_SIZEfiles.maxFileSize1000000000Max file size in bytes (1GB)
CHUNK_SIZEfiles.chunkSize8388608Chunk size for file uploads (8MB)
TRASH_CLEANUP_INTERVAL_DAYSfiles.trashCleanupIntervalDays7Days before auto-deleting trashed files

Security Configuration

Environment VariableConfig File PropertyDefaultDescription
SESSION_TIMEOUTsecurity.sessionTimeout7dSession timeout (e.g., 7d, 24h, 30m)

Documentation

Environment VariableConfig File PropertyDefaultDescription
DOCS_ENABLEDdocs.enabledtrueEnable Swagger API docs
DOCS_PATHdocs.pathdocsPath to access API docs

Access Swagger docs at: http://localhost:3331/docs

Single Sign-On (SSO) - Optional

Enable SSO with OIDC providers like Authelia, Authentik, Keycloak, etc.

Environment VariableConfig File PropertyRequiredDescription
SSO_ISSUERsso.issuerYesOIDC issuer URL
SSO_CLIENT_IDsso.clientIdYesOIDC client ID
SSO_CLIENT_SECRETsso.clientSecretYesOIDC client secret
SSO_REDIRECT_URIsso.redirectUriYesCallback URL after authentication
SSO_AUTO_CREATE_USERsso.autoCreateUserNoAuto-create user on first SSO login (default: false)

Example SSO configuration:

Environment variables:

SSO_ISSUER=https://auth.yourdomain.com
SSO_CLIENT_ID=agam-space-client
SSO_CLIENT_SECRET=your_secret_here
SSO_REDIRECT_URI=https://files.yourdomain.com/api/v1/auth/sso/oidc/callback
SSO_AUTO_CREATE_USER=false

Config file:

{
"sso": {
"issuer": "https://auth.yourdomain.com",
"clientId": "agam-space-client",
"clientSecret": "your_secret_here",
"redirectUri": "https://files.yourdomain.com/api/v1/auth/sso/oidc/callback",
"autoCreateUser": false
}
}

See SSO Configuration Guide for detailed setup.

WebAuthn - Optional

Required only if using WebAuthn for biometric device unlock.

Environment VariableConfig File PropertyRequiredDescription
WEBAUTHN_ORIGINwebauthn.originYesFull URL of your site (e.g., https://files.yourdomain.com)
WEBAUTHN_RPIDwebauthn.rpIdNoRelying Party ID (usually your domain) - defaults to localhost
DOMAINdomain.domainNoYour domain name (used for cookies)

Example WebAuthn configuration:

Environment variables:

DOMAIN=yourdomain.com
WEBAUTHN_ORIGIN=https://files.yourdomain.com
WEBAUTHN_RPID=yourdomain.com

Config file:

{
"domain": {
"domain": "yourdomain.com"
},
"webauthn": {
"origin": "https://files.yourdomain.com",
"rpId": "yourdomain.com"
}
}
WebAuthn is used for biometric unlock (Touch ID, Face ID, Windows Hello)

on trusted devices. Not required for basic functionality. :::

Complete Examples

Minimal Configuration

# Database (required)
DATABASE_HOST=postgres
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=your_secure_password
DATABASE_NAME=agam_space

# Server (optional - these are defaults)
HTTP_PORT=3331

# Account
ALLOW_NEW_SIGNUP=true

Production Configuration

# Database
DATABASE_HOST=postgres
DATABASE_PORT=5432
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=your_secure_password
DATABASE_NAME=agam_space
DATABASE_SSL=false

# Server
HTTP_PORT=3331
HTTP_HOST=0.0.0.0
NODE_ENV=production

# CORS - restrict to your domain
CORS_ORIGIN=https://files.yourdomain.com
CORS_CREDENTIALS=true

# Account - disable signups after creating your account
ALLOW_NEW_SIGNUP=false
DEFAULT_USER_STORAGE_QUOTA=50000000000

# File Storage
MAX_FILE_SIZE=2000000000
TRASH_CLEANUP_INTERVAL_DAYS=14

# WebAuthn
DOMAIN=yourdomain.com
WEBAUTHN_ORIGIN=https://files.yourdomain.com
WEBAUTHN_RPID=yourdomain.com

# Documentation - disable in production
DOCS_ENABLED=false

Environment Variable Precedence

Agam Space loads configuration in this order (later overrides earlier):

  1. Default values (from config schema)
  2. Environment variables (from .env file or Docker)
  3. Runtime overrides (rarely used)

Validation

All environment variables are validated on startup. If required variables are missing or invalid values are provided, the application will fail to start with a clear error message.

Source of Truth

This documentation is kept in sync with the configuration schema at: apps/api-server/src/config/config.schema.ts

If you find any discrepancies, please report them!