Skip to main content

Configuration

GoMFT can be customized through environment variables. This document provides a complete list of configuration options available in GoMFT.

Environment Variables

Environment variables are the primary way to configure GoMFT, especially when running in Docker. These variables can be set in your Docker Compose file, .env file, or directly in your system environment.

Core Configuration

VariableDescriptionDefaultExample
SERVER_ADDRESSServer address and port:8080SERVER_ADDRESS=:9000
DATA_DIRMain data directory./dataDATA_DIR=/app/data
BACKUP_DIRDirectory for backups./backupsBACKUP_DIR=/app/backups
JWT_SECRETSecret for JWT tokenschange_this_to_a_secure_random_stringJWT_SECRET=your-secure-secret-key
BASE_URLBase URL for GoMFT (used in email links)http://localhost:8080BASE_URL=https://gomft.example.com
SKIP_SSL_VERIFYSkip SSL verification for outgoing webhooks/notificationsfalseSKIP_SSL_VERIFY=false

Authentication Configuration

VariableDescriptionDefaultExample
TOTP_ENCRYPTION_KEYEncryption key for TOTP secretsthis-is-a-dev-key-not-for-production!TOTP_ENCRYPTION_KEY=your-secure-key
PUIDUser ID to run as (Docker only)PUID=1000
PGIDGroup ID to run as (Docker only)PGID=1000

Email Configuration

VariableDescriptionDefaultExample
EMAIL_ENABLEDEnable email functionalityfalseEMAIL_ENABLED=true
EMAIL_HOSTSMTP server hostnamesmtp.example.comEMAIL_HOST=smtp.gmail.com
EMAIL_PORTSMTP server port587EMAIL_PORT=587
EMAIL_USERNAMESMTP usernameuser@example.comEMAIL_USERNAME=your-email@example.com
EMAIL_PASSWORDSMTP passwordyour-passwordEMAIL_PASSWORD=your-smtp-password
EMAIL_FROM_EMAILFrom email addressgomft@example.comEMAIL_FROM_EMAIL=gomft@example.com
EMAIL_FROM_NAMEFrom nameGoMFTEMAIL_FROM_NAME=GoMFT Notifications
EMAIL_REPLY_TOReply-to email addressEMAIL_REPLY_TO=support@example.com
EMAIL_ENABLE_TLSUse TLS for SMTP connectiontrueEMAIL_ENABLE_TLS=true
EMAIL_REQUIRE_AUTHRequire authentication for SMTPtrueEMAIL_REQUIRE_AUTH=true

OAuth Configuration (Optional)

VariableDescriptionDefaultExample
GOOGLE_CLIENT_IDGoogle OAuth client IDGOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRETGoogle OAuth client secretGOOGLE_CLIENT_SECRET=your-client-secret

Configuration File

In addition to setting environment variables directly, GoMFT can also be configured using a .env file. This file should be placed in the root directory of your GoMFT installation.

Example .env file:

# Server Configuration
SERVER_ADDRESS=:8080
DATA_DIR=./data
BACKUP_DIR=./backups
JWT_SECRET=change_this_to_a_secure_random_string
BASE_URL=http://localhost:8080
SKIP_SSL_VERIFY=false

# Two-Factor Authentication configuration
TOTP_ENCRYPTION_KEY=this-is-a-dev-key-not-for-production!

# OAuth Configuration (optional)
# GOOGLE_CLIENT_ID=your_google_client_id
# GOOGLE_CLIENT_SECRET=your_google_client_secret

# Email Configuration
EMAIL_ENABLED=true
EMAIL_HOST=smtp.example.com
EMAIL_PORT=587
EMAIL_FROM_EMAIL=gomft@example.com
EMAIL_FROM_NAME=GoMFT
EMAIL_REPLY_TO=
EMAIL_ENABLE_TLS=true
EMAIL_REQUIRE_AUTH=true
EMAIL_USERNAME=your-email@example.com
EMAIL_PASSWORD=your-smtp-password

Priority Order

GoMFT uses the following priority order for configuration:

  1. Environment variables set directly
  2. Variables in the .env file
  3. Default values

This means that environment variables set directly will override settings in the .env file, which in turn override the default values.

Docker Configuration

When running GoMFT in Docker, you can configure the application in several ways:

Using Environment Variables

docker run -d \
--name gomft \
-p 8080:8080 \
-v /path/to/data:/app/data \
-v /path/to/backups:/app/backups \
-e SERVER_ADDRESS=:8080 \
-e JWT_SECRET=your-secure-secret \
-e EMAIL_ENABLED=true \
-e EMAIL_HOST=smtp.example.com \
-e PUID=1000 \
-e PGID=1000 \
starfleetcptn/gomft:latest

Using .env File

docker run -d \
--name gomft \
-p 8080:8080 \
-v /path/to/data:/app/data \
-v /path/to/backups:/app/backups \
-v /path/to/.env:/app/.env \
starfleetcptn/gomft:latest

Docker Compose Example

version: '3'

services:
gomft:
image: starfleetcptn/gomft:latest
container_name: gomft
ports:
- "8080:8080"
volumes:
- ./data:/app/data
- ./backups:/app/backups
- ./.env:/app/.env # Mount .env file (optional)
environment:
- PUID=1000
- PGID=1000
restart: unless-stopped

Applying Configuration Changes

Most configuration changes require a restart of the GoMFT service to take effect. After modifying environment variables or the .env file, restart your container or service:

# For Docker
docker restart gomft

# For Docker Compose
docker-compose restart gomft

Next Steps