Skip to content

Configuration

Manager uses YAML-based configuration with environment variable overrides for flexible deployment across different environments.

Configuration Loading

Configuration is loaded in the following priority order:

  1. config.local.yml - Local overrides (gitignored)
  2. config.yml - Fallback configuration (can be committed)
  3. Environment variables - PFY_ prefixed variables

Configuration File

Basic Structure

yaml
env: development # Environment: development, production
run_mode: both # Run mode: api, executor, both
port: 8080 # API server port
health_port: 8081 # Health check endpoint port
frontend_dir: ../frontend/dist
proxy_target: http://frontend:5173

db:
  host: localhost
  port: 5432
  user: postgres
  password: password
  name: productify
  sslmode: disable
  maxopen: 25
  maxidle: 10
  maxlifetime: 5m

pocket_id:
  host: http://pocketid.localhost
  api_key: your-api-key

cron:
  backend_heartbeat_timeout: 1m
  trigger_check_interval: 1s

dev_user_override:
  enabled: true
  id: ca53cb60-e72b-47b5-a7a3-9fa48dda681c
  email: user@productify.dev
  name: Test User
  username: test

Configuration Options

Server

OptionTypeDefaultDescription
envstringdevelopmentEnvironment mode (development, production)
run_modestringbothRun mode: api, executor, or both
portint8080Main API server port
health_portint8081Health check endpoint port
frontend_dirstring-Path to frontend build directory
proxy_targetstring-Development proxy target for frontend

Database

OptionTypeDefaultDescription
db.hoststringlocalhostDatabase host
db.portint5432Database port
db.userstringpostgresDatabase user
db.passwordstringpostgresDatabase password
db.namestringpostgresDatabase name
db.sslmodestringdisableSSL mode (disable, require, verify-full)
db.maxopenint1000Maximum open connections
db.maxidleint100Maximum idle connections
db.maxlifetimeduration1hConnection maximum lifetime

PocketID Integration

OptionTypeDefaultDescription
pocket_id.hoststring-PocketID host URL
pocket_id.api_keystring-PocketID API key

Cron / Trigger System

OptionTypeDefaultDescription
cron.backend_heartbeat_timeoutduration1mBackend heartbeat timeout
cron.trigger_check_intervalduration1sTrigger check interval
cron.metrics_portint9090Prometheus metrics port (executor mode only)

Executor Metrics

When running in executor mode, Prometheus metrics are exposed on the configured metrics_port (default: 9090) at the /metrics endpoint. These metrics include per-application queue statistics, processing times, and backend dispatch results for autoscaler integration.

Development Overrides

OptionTypeDefaultDescription
dev_user_override.enabledboolfalseEnable dev user override
dev_user_override.idstring-User ID
dev_user_override.emailstring-User email
dev_user_override.namestring-User name
dev_user_override.usernamestring-Username

Development Only

The dev_user_override feature bypasses authentication and should never be enabled in production.

Environment Variables

All configuration options can be overridden using environment variables with the PFY_ prefix:

Examples

bash
# Server
export PFY_ENV=production
export PFY_RUN_MODE=api
export PFY_PORT=8080
export PFY_HEALTH_PORT=8081

# Database
export PFY_DB_HOST=db.example.com
export PFY_DB_PORT=5432
export PFY_DB_USER=dbuser
export PFY_DB_PASSWORD=secret
export PFY_DB_NAME=productify
export PFY_DB_SSLMODE=require
export PFY_DB_MAXOPEN=100
export PFY_DB_MAXIDLE=25

# PocketID
export PFY_POCKET_ID_HOST=https://auth.example.com
export PFY_POCKET_ID_API_KEY=your-api-key

# Cron
export PFY_CRON_BACKEND_HEARTBEAT_TIMEOUT=2m
export PFY_CRON_TRIGGER_CHECK_INTERVAL=1s
export PFY_CRON_METRICS_PORT=9090

Naming Convention

Environment variables follow this pattern:

  • Prefix: PFY_
  • Uppercase with underscores
  • Nested keys separated by _

Example: pocket_id.api_keyPFY_POCKET_ID_API_KEY

Run Modes

Manager supports three run modes for flexible deployment:

both (Default)

Runs both API server and trigger executor in a single process. Ideal for development and small deployments.

yaml
run_mode: both

api

Runs only the API server without the trigger executor. Use for horizontal scaling of API instances.

yaml
run_mode: api

executor

Runs only the trigger executor without the API server. Use for dedicated cron job processing.

yaml
run_mode: executor

Configuration Examples

Development

yaml
env: development
run_mode: both
port: 8080
db:
  host: localhost
  port: 5432
  user: postgres
  password: password
  dbname: productify
dev_user_override:
  enabled: true
  email: dev@localhost

Production (API Instance)

yaml
env: production
run_mode: api
port: 8080
db:
  host: db.prod.internal
  port: 5432
  user: manager_api
  password: ${DB_PASSWORD}
  dbname: productify
  sslmode: verify-full
  max_open_conns: 50
pocket_id:
  host: https://auth.company.com
  api_key: ${POCKET_ID_KEY}

Production (Executor Instance)

yaml
env: production
run_mode: executor
db:
  host: db.prod.internal
  port: 5432
  user: manager_executor
  password: ${DB_PASSWORD}
  dbname: productify
  sslmode: verify-full
cron:
  backend_heartbeat_timeout: 2m
  trigger_check_interval: 1s
  metrics_port: 9090

Accessing Metrics:

bash
# Prometheus metrics for autoscaler
curl http://executor-host:9090/metrics

Security Best Practices

  1. Never commit config.local.yml - It's gitignored for a reason
  2. Use environment variables for sensitive data in production
  3. Enable SSL for database connections in production (sslmode: verify-full)
  4. Disable dev_user_override in production
  5. Use strong passwords and rotate credentials regularly
  6. Limit database connections based on your infrastructure

See Also