Skip to content

Configuration Reference

Eric Fitzgerald edited this page Nov 12, 2025 · 1 revision

Configuration Reference

This page documents all server and web application configuration options for TMI.

Server Configuration (Go Backend)

The TMI server can be configured via environment variables, YAML configuration files, or .env files.

Quick Start

# Copy and customize the example configuration
cp config-example.yml config-development.yml

# Start the server with custom config
./bin/tmiserver --env=/path/to/config.yml

Server Settings

Variable Default Description
SERVER_PORT 8080 HTTP/HTTPS server port
SERVER_INTERFACE 0.0.0.0 Network interface to listen on
SERVER_READ_TIMEOUT 5s HTTP read timeout
SERVER_WRITE_TIMEOUT 10s HTTP write timeout
SERVER_IDLE_TIMEOUT 60s HTTP idle timeout
LOG_LEVEL info Logging level (debug, info, warn, error)

TLS/HTTPS Configuration

Variable Default Description
TLS_ENABLED false Enable HTTPS/TLS
TLS_CERT_FILE Path to TLS certificate file
TLS_KEY_FILE Path to TLS private key file
TLS_SUBJECT_NAME [hostname] Subject name for certificate validation
TLS_HTTP_REDIRECT true Redirect HTTP to HTTPS when TLS enabled

JWT Authentication

Variable Default Description
JWT_SECRET secret JWT signing secret (change for production!)
JWT_EXPIRES_IN 24h JWT token expiration
JWT_SIGNING_METHOD HS256 JWT signing method (HS256/RS256)

OAuth Configuration

Variable Example Description
OAUTH_CALLBACK_URL http://localhost:8080/oauth2/callback OAuth callback URL
OAUTH_PROVIDERS_GITHUB_CLIENT_ID GitHub OAuth client ID
OAUTH_PROVIDERS_GITHUB_CLIENT_SECRET GitHub OAuth client secret
OAUTH_PROVIDERS_GOOGLE_CLIENT_ID Google OAuth client ID
OAUTH_PROVIDERS_GOOGLE_CLIENT_SECRET Google OAuth client secret
OAUTH_PROVIDERS_MICROSOFT_CLIENT_ID Microsoft/Azure OAuth client ID
OAUTH_PROVIDERS_MICROSOFT_CLIENT_SECRET Microsoft/Azure OAuth client secret

See Setting Up Authentication for detailed OAuth setup instructions.

Database Configuration

PostgreSQL

Variable Default Description
DB_HOST localhost PostgreSQL server host
DB_PORT 5432 PostgreSQL server port
DB_USERNAME postgres Database username
DB_PASSWORD Database password
DB_NAME tmi Database name
DB_SSLMODE disable SSL mode (disable/require/prefer)

Redis

Variable Default Description
REDIS_HOST localhost Redis server host
REDIS_PORT 6379 Redis server port
REDIS_PASSWORD Redis password (if required)
REDIS_DB 0 Redis database number

Environment Variables

Variable Default Description
ENV development Environment mode (development/production)

Web Application Configuration (Angular Frontend)

The TMI UX web application is configured through environment files located in src/environments/.

Environment Files

  • environment.ts - Default development environment
  • environment.prod.ts - Production environment
  • environment.staging.ts - Staging environment
  • environment.test.ts - Test environment
  • environment.local.ts - Local development (git-ignored)
  • environment.example.ts - Template with documentation

Environment Settings

Setting Default Description
production false Enable production mode
logLevel ERROR Logging verbosity (DEBUG, INFO, WARN, ERROR)
apiUrl https://api.example.com/v1 API server URL
authTokenExpiryMinutes 60 Authentication token validity
operatorName TMI Operator Name of service operator
operatorContact [email protected] Contact information
serverPort 4200 Server listening port
serverInterface 0.0.0.0 Server listening interface
enableTLS false Enable HTTPS
tlsKeyPath undefined Path to TLS private key
tlsCertPath undefined Path to TLS certificate
tlsSubjectName System hostname TLS subject name

Running with Different Environments

# Default environment
pnpm run dev

# Specific environment
pnpm run dev:staging
pnpm run dev:prod

# Custom configuration via environment variables
export TMI_API_URL=http://localhost:8080
pnpm run dev

Creating Custom Environments

  1. Copy src/environments/environment.example.ts to src/environments/environment.custom.ts
  2. Configure values as needed (at minimum set apiUrl to your TMI server)
  3. Update angular.json with configuration if creating persistent build target
{
  "configurations": {
    "custom": {
      "fileReplacements": [
        {
          "replace": "src/environments/environment.ts",
          "with": "src/environments/environment.custom.ts"
        }
      ]
    }
  }
}

WebSocket Configuration

When TLS is enabled (TLS_ENABLED=true), clients must use secure WebSocket URLs:

  • Use wss:// instead of ws:// for WebSocket connections
  • Example: wss://your-server.com:8080/ws/diagrams/123

When TLS is disabled, use standard WebSocket URLs:

  • Example: ws://your-server.com:8080/ws/diagrams/123

Use the /api/server-info endpoint to get the correct WebSocket base URL automatically.

Configuration Files

Server Configuration File Format

The server uses YAML configuration files:

server:
  port: "8080"
  interface: "0.0.0.0"
  tls_enabled: false

database:
  postgres:
    host: "localhost"
    port: "5432"
    user: "postgres"
    password: ""
    database: "tmi"
  redis:
    host: "localhost"
    port: "6379"

auth:
  jwt:
    secret: "CHANGE_ME"
    expiration_seconds: 86400
  oauth:
    callback_url: "http://localhost:8080/oauth2/callback"

See config-example.yml in the tmi repository for complete configuration examples.

Related Documentation

Clone this wiki locally