Configuration
iForge is configured through environment variables. For a complete example, see .env.example.
Backend Configuration
Basic Configuration
| Variable | Description | Default |
|---|---|---|
IFORGE_HOME | Data directory (database, logs, Git repositories) | ./data |
IFORGE_HTTP_PORT | HTTP service port (browser + Git HTTP) | 8081 |
IFORGE_SESSION_SECRET | Session secret (auto-generated and persisted to database if left empty) | Auto-generated |
- 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
| Variable | Description | Default |
|---|---|---|
IFORGE_SSH_ENABLED | Whether to enable SSH Git service | true |
IFORGE_SSH_PORT | SSH Git service port | 2022 |
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
| Variable | Description | Default |
|---|---|---|
IFORGE_CORS_ORIGINS | CORS allowed frontend origins | localhost |
*: 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
| Variable | Description | Default |
|---|---|---|
NEXT_PUBLIC_API_BASE | Backend API base URL | Empty (dynamic adaptation) |
SERVER_API_URL | SSR data request URL (Docker internal network) | Empty |
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 tohttp://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
| Variable | Description | Default |
|---|---|---|
IFORGE_CI_ENABLED | Whether to enable CI/CD functionality | true |
IFORGE_CI_ALLOW_SHELL_EXECUTOR | Whether to allow Shell Executor (must be false in production) | false |
IFORGE_CI_KEEP_WORKDIR | Whether to keep Job working directory (for debugging) | false |
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.