Skip to main content

Configuration

iForge is configured through environment variables. For a complete example, see .env.example.

Backend Configuration

Basic Configuration

VariableDescriptionDefault
IFORGE_HOMEData directory (database, logs, Git repositories)./data
IFORGE_HTTP_PORTHTTP service port (browser + Git HTTP)8081
IFORGE_SESSION_SECRETSession secret (auto-generated and persisted to database if left empty)Auto-generated
Session Secret
  • Leave empty (recommended): A 32-byte random secret is automatically generated on first startup and persisted to the database. The same secret is reused after restart without affecting login state.
  • Multi-replica deployment (K8s multi-Pod, multi-container): Must be set to a fixed value, otherwise each replica will have a different secret.

SSH Git Service

VariableDescriptionDefault
IFORGE_SSH_ENABLEDWhether to enable SSH Git servicetrue
IFORGE_SSH_PORTSSH Git service port2022
Using Port 22

To use the standard SSH port 22, set IFORGE_SSH_PORT=22. Note: If sshd is already running on the host, you need to stop it first or use a different port.

CORS Configuration

VariableDescriptionDefault
IFORGE_CORS_ORIGINSCORS allowed frontend originslocalhost
  • *: Reflect any Origin (recommended for self-hosted/LAN deployment, compatible with cookie credentials)
  • Specific values: http://192.168.1.100:3001 (comma-separated for multiple, stricter)

Frontend Configuration

VariableDescriptionDefault
NEXT_PUBLIC_API_BASEBackend API base URLEmpty (dynamic adaptation)
SERVER_API_URLSSR data request URL (Docker internal network)Empty
Dynamic API URL

When NEXT_PUBLIC_API_BASE is left empty, the frontend runtime automatically adapts according to the browser's window.location.hostname:

  • LAN access http://192.168.1.100:3001 → API requests sent to http://192.168.1.100:8081
  • For custom domains, set to a fixed value: https://iforge.example.com/api/v1

Docker Internal Network

During Docker deployment, the web container and server container communicate through Docker's internal network:

# docker-compose.yml web service
environment:
- SERVER_API_URL=http://server:8081/api/v1 # SSR uses internal network

Browser-side requests are not affected by this and still dynamically adapt according to window.location.hostname.

CI/CD Configuration

VariableDescriptionDefault
IFORGE_CI_ENABLEDWhether to enable CI/CD functionalitytrue
IFORGE_CI_ALLOW_SHELL_EXECUTORWhether to allow Shell Executor (must be false in production)false
IFORGE_CI_KEEP_WORKDIRWhether to keep Job working directory (for debugging)false
Shell Executor Security Warning

Shell Executor directly executes user code on the host, posing serious security risks. Production environments must keep it disabled (IFORGE_CI_ALLOW_SHELL_EXECUTOR=false).

To enable it in the development environment, set IFORGE_CI_ALLOW_SHELL_EXECUTOR=true.

Database

The current version uses SQLite as the default database ({IFORGE_HOME}/iforge.db), with tables automatically created by GORM AutoMigrate.

MySQL/PostgreSQL drivers are already supported in the code. To switch, modify the InitGORMDB call in server/cmd/server/main.go.