Configure your environment variables and settings
This document provides detailed information about all environment variables used in the GitLab Claude Manager application.
Copy the example file:
cp env.example .env
Configure required variables:
NEXTAUTH_SECRET - Generate with openssl rand -base64 32NEXTAUTH_URL - Your application URLStart the application:
pnpm dev
For production deployments, use the following template. Generate secure values for each secret before deploying.
Required - generate with: openssl rand -base64 32
NEXTAUTH_SECRET=<your-generated-secret>
Required - your production URL (no trailing slash)
NEXTAUTH_URL=https://your-domain.com
Required for production - generate with: openssl rand -hex 32
Prevents unauthorized first-user account creation
INITIAL_SIGNUP_TOKEN=<your-generated-token>
# ---- Required ---- NEXTAUTH_SECRET=<your-generated-secret> NEXTAUTH_URL=https://your-domain.com INITIAL_SIGNUP_TOKEN=<your-generated-token> # ---- Security (recommended) ---- ALLOWED_IPS=<your-trusted-ips> API_RATE_LIMIT=100 # ---- Integration credentials (or configure via Dashboard UI) ---- ANTHROPIC_API_KEY=<your-anthropic-key> # GitLab (for GitLab repositories) GITLAB_URL=https://gitlab.com GITLAB_TOKEN=<your-gitlab-token> ALLOWED_GITLAB_HOSTS=gitlab.com # GitHub (for GitHub repositories) GITHUB_TOKEN=<your-github-token>
Run these commands to generate the required secrets:
Generate NEXTAUTH_SECRET
echo "NEXTAUTH_SECRET=$(openssl rand -base64 32)"
Generate INITIAL_SIGNUP_TOKEN
echo "INITIAL_SIGNUP_TOKEN=$(openssl rand -hex 32)"
openssl rand -base64 32jFQOQfMxoJmilm9tKJUzzL1lMnihAaAl4jcoTgBkH9k=http://localhost:3000https://your-domain.comRecommended: Use the Dashboard to generate and manage API keys instead of environment variables. Navigate to Dashboard → Account Security to generate keys. Dashboard-generated keys are stored in
workspaces/api-keys.jsonand are automatically validated.
key1,key2,key3openssl rand -hex 32 (for each key)abc123def456,xyz789ghi012openssl rand -hex 32100200Required: No
Description: IP whitelist for API access.
Format: Comma-separated IPs or * for all
Default: Allow all (if not set)
Examples:
192.168.1.100,10.0.0.50 - Specific IPs* - Allow allReverse proxy note (Traefik/Caddy):
The app determines the client IP from x-forwarded-for (first value) or x-real-ip.
Only enable ALLOWED_IPS if your reverse proxy is trusted and overwrites/sanitizes these headers.
Do not expose the app container/port directly to the internet; only your reverse proxy should be able to reach it (private Docker network / firewall).
Caddy example (overwrite headers):
reverse_proxy workflow-app:3000 {
header_up X-Forwarded-For {remote_host}
header_up X-Real-IP {remote_host}
}
Traefik: configure forwarded headers so untrusted client-supplied X-Forwarded-* values are not accepted (use trusted proxy hops / trustedIPs and keep insecure=false).
claude CLI subprocessauto (default): use an API key if available, otherwise rely on CLI logincli: never pass ANTHROPIC_API_KEY to the claude subprocess (useful for Claude subscription accounts that require interactive login)CLAUDE_CODE_AUTH_MODE=cliglpat-)api, read_repository, write_repositoryhttps://gitlab.comhttps://gitlab.company.com (for self-hosted)gitlab.comgitlab.com,gitlab.company.comghp_ for fine-grained tokens or github_pat_ for classic tokens)repo (full repository access)development | production | test1 (disabled) or 0 (enabled)01 in CI/CDdebug | info | warn | errorinfoopenssl rand -hex 325003gitlab-claude-The GitLab Claude Manager supports multiple configuration methods:
In your .env file:
NEXTAUTH_SECRET=your-secret GITLAB_TOKEN=your-token
Never commit .env files
.env file is in .gitignoreenv.example as a templateUse strong secrets
Rotate credentials regularly
Separate environments
Limit API access
Secure storage
For NEXTAUTH_SECRET:
openssl rand -base64 32
For API keys:
openssl rand -hex 32
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"python3 -c "import secrets; print(secrets.token_hex(32))"
Error: NEXTAUTH_SECRET is required but not set
Solution:
Generate a secret:
openssl rand -base64 32
Add to .env:
echo "NEXTAUTH_SECRET=<generated-secret>" >> .env
Error: Invalid API key or Authentication service not configured
Solutions:
VALID_API_KEYS or ADMIN_API_KEY in environment variablesworkspaces/api-keys.json exists if using dashboard-generated keysError: Access denied from this IP address
Solutions:
ALLOWED_IPSALLOWED_IPS=* to allow all (development only)x-forwarded-for header if behind proxyThe application checks for configuration in this order:
workspaces/api-keys.json)ADMIN_API_KEY environment variable)VALID_API_KEYS environment variable)workspaces/app-config.json)