# Activepieces Environment Variables
# Copy this file to .envs/.production/.activepieces and fill in values
# ==============================================================================

# External URL (for browser iframe embed)
AP_FRONTEND_URL=https://automations.smoothschedule.com

# Internal URL (for Django API calls within Docker network)
AP_INTERNAL_URL=http://activepieces:80

# Security Keys - MUST match between Activepieces and Django
# Generate with: openssl rand -hex 32
AP_JWT_SECRET=<generate-with-openssl-rand-hex-32>
AP_ENCRYPTION_KEY=<generate-with-openssl-rand-hex-16>

# Platform/Project IDs
# ------------------------------------------------------------------------------
# These are generated when you first create an admin user in Activepieces
# Leave blank for initial deployment, then update after setup
#
# IMPORTANT: After initial setup:
# 1. Visit https://automations.smoothschedule.com
# 2. Create an admin account (this creates the platform)
# 3. Get platform ID from the database:
#    docker compose exec postgres psql -U <user> -d activepieces -c "SELECT id FROM platform LIMIT 1"
# 4. Update AP_PLATFORM_ID here AND in .django file
AP_DEFAULT_PROJECT_ID=
AP_PLATFORM_ID=

# Database (using same PostgreSQL as SmoothSchedule, but different database)
# ------------------------------------------------------------------------------
AP_POSTGRES_HOST=postgres
AP_POSTGRES_PORT=5432
AP_POSTGRES_DATABASE=activepieces

# Generate strong random values for these (separate from main DB credentials)
AP_POSTGRES_USERNAME=<random-username>
AP_POSTGRES_PASSWORD=<random-password>

# Redis
# ------------------------------------------------------------------------------
AP_REDIS_HOST=redis
AP_REDIS_PORT=6379

# AI Copilot (optional)
# ------------------------------------------------------------------------------
AP_OPENAI_API_KEY=<your-openai-api-key>

# Execution Settings
# ------------------------------------------------------------------------------
AP_EXECUTION_MODE=UNSANDBOXED
AP_TELEMETRY_ENABLED=false

# Pieces Configuration
# ------------------------------------------------------------------------------
# CLOUD_AND_DB: Fetch pieces from cloud registry and local database
AP_PIECES_SOURCE=CLOUD_AND_DB
# OFFICIAL_AUTO: Automatically sync official pieces metadata from cloud
AP_PIECES_SYNC_MODE=OFFICIAL_AUTO

# Embedding (required for iframe integration)
# ------------------------------------------------------------------------------
AP_EMBEDDING_ENABLED=true

# Templates (fetch official templates from Activepieces cloud)
# ------------------------------------------------------------------------------
AP_TEMPLATES_SOURCE_URL=https://cloud.activepieces.com/api/v1/templates

# Custom Pieces Registry (Verdaccio - internal)
# ------------------------------------------------------------------------------
VERDACCIO_URL=http://verdaccio:4873
