Files
opencode-manager/docs/configuration/environment.md
T
Chris Scott da6cad8b3a Add comprehensive documentation and download feature (#83)
* fix: markdown files now default to rendered view and render properly

- Add .md and .mdx MIME type support in backend (files.ts, defaults.ts)
- Add key props to FilePreview components to force proper remounting when switching files
- Fix markdown file detection with case-insensitive extension check
- Reset markdownPreview state when file changes to ensure correct default view
- Add onContentLoaded callback to VirtualizedTextView for reactive content updates
- Add fullContent state to properly handle large markdown file rendering
- Add error handling for async content loading to prevent blank screens
- Reduce loading timeout from 50ms to 0ms for more responsive loading

Fixes issues where:
- Markdown files opened in raw view instead of rendered view
- Large markdown files (12k+ lines) showed blank after loading completed
- State persisted incorrectly when switching between different file types

* Add directory download feature with ZIP archive support

* Improve voice recording UX with loading states and better transcript handling

* Fix auth config for prod/dev ports and add documentation

Update AUTH_TRUSTED_ORIGINS and PASSKEY_ORIGIN to use backend port 5003 (frontend uses 5173 in dev). Add comprehensive auth documentation covering secrets, trusted origins, admin reset, and passkeys. Update README and add mkdocs config.

* Remove roadmap section from README
2026-01-26 23:09:27 -05:00

3.4 KiB

Environment Variables

Complete reference for all configuration options.

Authentication

Variable Description Default
AUTH_SECRET Session encryption secret (required for production) Auto-generated in dev
ADMIN_EMAIL Pre-configured admin email -
ADMIN_PASSWORD Pre-configured admin password -
ADMIN_PASSWORD_RESET Set to true to reset admin password false
AUTH_TRUSTED_ORIGINS Comma-separated list of trusted origins (frontend + backend) http://localhost:5173,http://localhost:5003
AUTH_SECURE_COOKIES Use secure cookies (HTTPS only) true in prod
AUTH_SECURE_COOKIES Use secure cookies (HTTPS only) true in prod

OAuth Providers

Variable Description
GITHUB_CLIENT_ID GitHub OAuth client ID
GITHUB_CLIENT_SECRET GitHub OAuth client secret
GOOGLE_CLIENT_ID Google OAuth client ID
GOOGLE_CLIENT_SECRET Google OAuth client secret
DISCORD_CLIENT_ID Discord OAuth client ID
DISCORD_CLIENT_SECRET Discord OAuth client secret

Passkeys (WebAuthn)

Variable Description Default
PASSKEY_RP_ID Relying party ID (your domain) localhost
PASSKEY_RP_NAME Display name for passkey prompts OpenCode Manager
PASSKEY_ORIGIN Origin URL for WebAuthn (backend port) http://localhost:5003

!!! tip "IMPORTANT" - PASSKEY_ORIGIN must use the backend port (5003), not the frontend port (5173) - The origin must exactly match where the auth API is served

Server

Variable Description Default
PORT Server port 5003
NODE_ENV Environment (development or production) development
WORKSPACE_PATH Path to workspace directory /workspace

Example .env File

# Required for production
AUTH_SECRET=generate-with-openssl-rand-base64-32

# Pre-configured admin (optional)
ADMIN_EMAIL=admin@example.com
ADMIN_PASSWORD=your-secure-password

# Remote access (optional - include both frontend and backend ports)
AUTH_TRUSTED_ORIGINS=http://localhost:5173,http://localhost:5003,http://192.168.1.244:5003
AUTH_SECURE_COOKIES=false

# OAuth providers (optional)
GITHUB_CLIENT_ID=your-client-id
GITHUB_CLIENT_SECRET=your-client-secret

# Passkeys (optional - use BACKEND port)
PASSKEY_RP_ID=localhost
PASSKEY_RP_NAME=OpenCode Manager
PASSKEY_ORIGIN=http://localhost:5003

Generating Secrets

AUTH_SECRET

Generate a secure random secret:

openssl rand -base64 32

Output example:

K7gNU3sdo+OL0wNhqoVWhr3g6s1xYv72ol/pe/Unols=

!!! warning "Security" - Never commit AUTH_SECRET to version control - Use different secrets for development and production - Rotate secrets periodically

Environment Precedence

Variables are loaded in this order (later overrides earlier):

  1. System environment variables
  2. .env file in project root
  3. Docker Compose environment section
  4. Docker Compose env_file reference

Validating Configuration

Check your configuration:

# View current environment (inside container)
docker exec opencode-manager env | grep -E '^(AUTH|ADMIN|PASSKEY)'

# Check if secrets are set (without revealing values)
docker exec opencode-manager sh -c 'if [ -n "$AUTH_SECRET" ]; then echo "AUTH_SECRET: set"; else echo "AUTH_SECRET: NOT SET"; fi'