# ==============================================================================
# Naagmani Self-Hosted Standalone — Environment Configuration Example
# Copy to .env and fill every blank password/key before deployment.
# Generate independent random secrets; the installer does this automatically.
# ==============================================================================

# --- Global & Deployment Mode ---
NAAGMANI_ENV=production
NODE_ENV=production
LOG_LEVEL=info
NAAGMANI_LOG_LEVEL=info
NAAGMANI_LOG_FORMAT=json

# --- Database Configuration (PostgreSQL 16 + pgvector) ---
# Direct full URLs for each service database (or use credentials below)
# DATABASE_URL_CLOUD=postgres://naagmani:your_password@postgres:5432/naagmani_selfhosted?sslmode=disable
# DATABASE_URL_OS=postgres://naagmani:your_password@postgres:5432/naagmani?sslmode=disable
POSTGRES_USER=naagmani
POSTGRES_PASSWORD=
POSTGRES_DB_CLOUD=naagmani_selfhosted
POSTGRES_DB_OS=naagmani
POSTGRES_PORT=5433

# --- Redis Configuration ---
# Direct full Redis URLs (DB 0 for Cloud API, DB 1 for OS Gateway)
# REDIS_URL_CLOUD=redis://redis:6379/0
# REDIS_URL_OS=redis://redis:6379/1
REDIS_PORT=6379

# --- Inter-Service Security & Cryptography (>= 32 chars) ---
JWT_SECRET=
ACCESS_TOKEN_TTL_SECONDS=900
NAAGMANI_SESSION_SECRET=
NAAGMANI_ENCRYPTION_KEY=
# Generate nm_live_ followed by 48 random hex characters; share with OS and API.
NAAGMANI_SYSTEM_KEY=
# --- Ports (Offset to prevent port conflicts) ---
CLOUD_PORT=9081
NAAGMANI_CLOUD_PORT=9081
OS_PORT=9080
NAAGMANI_OS_PORT=9080
DEVELOPER_PORT=3001
PORTAL_PORT=3001

# --- Public Domains & Network URLs ---
PORTAL_BASE_URL=http://localhost:3001
CLOUD_BASE_URL=http://localhost:9081
NEXT_PUBLIC_API_BASE_URL=http://localhost:9081
NEXT_PUBLIC_CLOUD_API_URL=http://localhost:9081
NEXT_PUBLIC_OS_API_URL=http://localhost:9080
NEXT_PUBLIC_DOCS_URL=https://docs.naagmani.com
ACCOUNTS_WEB_URL=https://accounts.naagmani.com
NEXT_PUBLIC_UPSTREAM_CLOUD_URL=https://api.naagmani.com
NEXT_PUBLIC_UPSTREAM_CONSOLE_URL=https://console.naagmani.com
NAAGMANI_CORS_ALLOWED_ORIGINS=http://localhost:3000,http://localhost:9081,http://localhost:9080,http://localhost:3001
NAAGMANI_ALLOWED_INTERNAL_HOSTS=os
NAAGMANI_TRUSTED_PROXIES=127.0.0.1,::1
NAAGMANI_RATE_LIMIT_ENABLED=true

# --- Local Organization Owner (never the vendor Super Admin) ---
NAAGMANI_ADMIN_EMAIL=admin@selfhosted.local
# Local/self-hosted login only. Accounts SSO passwords belong in ACCOUNTS_ADMIN_PASSWORD.
NAAGMANI_ADMIN_PASSWORD=

# --- Enterprise License Public Key (For offline validation on OS nodes) ---
NAAGMANI_LICENSE_PUBLIC_KEY=276271788609ea1ec8637e2a1c18efea0c86ec3016acf4b84f08acec525067c3
NAAGMANI_LICENSE_DATA=
NAAGMANI_LICENSE_PATH=
NAAGMANI_INSTALLATION_ID=

# --- Transactional Notification Emails (Optional for Self-Hosted) ---
EMAIL_ENABLED=false
EMAIL_FROM=billing@naagmani.ai
SMTP_HOST=
SMTP_PORT=587
SMTP_SECURITY=starttls
SMTP_USERNAME=
SMTP_PASSWORD=
