Skip to content

Latest commit

 

History

History
215 lines (163 loc) · 6.18 KB

File metadata and controls

215 lines (163 loc) · 6.18 KB

Environment Variables Sync Guide

Overview

I've successfully analyzed your ICC Rule Engine codebase and created a comprehensive .env file with all the environment variables your application uses. This guide explains how to sync environment variables from your Render service to your local development environment.

What Was Created

Files Created:

  • .env - Your local environment variables file (6,399 bytes)
  • .env.backup - Backup of your previous .env file
  • sync_env_vars.py - Script to regenerate the .env file
  • ENV_SYNC_GUIDE.md - This guide

Environment Variables Found

Based on code analysis, your application uses 50+ environment variables across these categories:

Core Application Settings

  • ENVIRONMENT - Environment mode (development/production)
  • DEMO_MODE - Demo mode flag
  • PORT - Application port

Database Configuration

  • DATABASE_URL - Database connection string

Redis Configuration

  • REDIS_URL - Redis connection string
  • ALLOW_IN_MEMORY_REDIS - Allow in-memory Redis for demo

Authentication & Security

  • JWT_SECRET - JWT token signing secret
  • SESSION_SECRET - Session signing secret

CORS Configuration

  • ALLOWED_ORIGINS - CORS allowed origins
  • ADMIN_CORS_ORIGINS - Admin CORS origins

Feature Flags

  • MULTI_TENANT_ENABLED - Multi-tenant support
  • USAGE_LOGGING_ENABLED - Usage logging for billing
  • LOGGING_ENABLED - Structured logging
  • LLM_VALIDATION_ENABLED - LLM validation
  • METRICS_COLLECTION_ENABLED - Metrics collection
  • METRICS_ENABLED - Metrics endpoint
  • ASYNC_VALIDATION_ENABLED - Async validation

Rate Limiting & Quotas

  • RATE_LIMIT_REQUESTS - Rate limit requests per window
  • RATE_LIMIT_WINDOW - Rate limit window in seconds

Queue Configuration

  • QUEUE_MAX_RETRIES - Queue max retries
  • QUEUE_RETRY_BACKOFF_BASE - Queue retry backoff
  • REGION - Processing region

Telemetry & Monitoring

  • TELEMETRY_ENABLED - Telemetry collection
  • TELEMETRY_PIPELINE_V2 - Telemetry pipeline v2
  • TELEMETRY_TRANSPORT - Telemetry transport method
  • TELEMETRY_SERVICE - Service name
  • TELEMETRY_BUFFER_SIZE - Telemetry buffer size
  • TELEMETRY_SQLITE_PATH - Telemetry SQLite path
  • TELEMETRY_DB_PATH - Telemetry database path

Kafka Configuration

  • KAFKA_ENABLED - Kafka integration
  • KAFKA_BROKERS - Kafka brokers
  • TELEMETRY_KAFKA_BROKERS - Telemetry Kafka brokers
  • TELEMETRY_KAFKA_TOPIC - Telemetry Kafka topic
  • TELEMETRY_KAFKA_GROUP - Telemetry Kafka group

Redis Telemetry

  • TELEMETRY_REDIS_DSN - Telemetry Redis DSN
  • TELEMETRY_REDIS_LIST - Telemetry Redis list
  • TELEMETRY_REDIS_STREAM - Telemetry Redis stream

ClickHouse Configuration

  • CLICKHOUSE_DSN - ClickHouse DSN
  • TELEMETRY_CLICKHOUSE_DSN - Telemetry ClickHouse DSN
  • TELEMETRY_CLICKHOUSE_TABLE - Telemetry ClickHouse table
  • TELEMETRY_POLL_INTERVAL_MS - Telemetry poll interval
  • TELEMETRY_MAX_BATCH - Telemetry max batch size

External Services

  • OPENAI_API_KEY - OpenAI API key
  • STRIPE_SECRET_KEY - Stripe secret key
  • STRIPE_PUBLISHABLE_KEY - Stripe publishable key
  • STRIPE_WEBHOOK_SECRET - Stripe webhook secret
  • STRIPE_CHECKOUT_SUCCESS_URL - Stripe success URL
  • STRIPE_CHECKOUT_CANCEL_URL - Stripe cancel URL

Support Services

  • ZENDESK_SUBDOMAIN - Zendesk subdomain
  • ZENDESK_EMAIL - Zendesk email
  • ZENDESK_API_TOKEN - Zendesk API token
  • JIRA_BASE_URL - JIRA base URL
  • JIRA_EMAIL - JIRA email
  • JIRA_API_TOKEN - JIRA API token
  • JIRA_PROJECT_KEY - JIRA project key

System Identification

  • HOSTNAME - System hostname
  • COMPUTERNAME - Computer name
  • INSTANCE_ID - Instance ID
  • SERVICE_NAME - Service name

Development Settings

  • DEBUG - Debug mode
  • RELOAD - Auto-reload

Next Steps

1. Update Your Local .env File

Edit the .env file with your local development values:

# Essential for local development
JWT_SECRET=your-local-jwt-secret-here
SESSION_SECRET=your-local-session-secret-here
DATABASE_URL=sqlite:///icc_rules.db
REDIS_URL=redis://localhost:6379

2. Get Production Values from Render

Since Render doesn't expose environment variables via API for security reasons, you'll need to:

  1. Go to your Render dashboard:

  2. Copy production values:

    • Copy the values you need from Render
    • Update your local .env file accordingly

3. Set Up Local Services

For local development, you'll need:

  • Database: SQLite (default) or PostgreSQL
  • Redis: Local Redis instance
  • Optional: OpenAI API key for LLM features

4. Test Your Setup

# Start your application
uvicorn app.main:app --reload

# Check health endpoint
curl http://localhost:8000/health

Regenerating the .env File

If you need to regenerate the .env file:

python sync_env_vars.py

This will:

  • Analyze your codebase for environment variables
  • Create a new .env file with all variables
  • Backup your existing .env file

Security Notes

  • Never commit .env files to version control
  • Use strong secrets for JWT_SECRET and SESSION_SECRET
  • Keep API keys secure and don't share them
  • Use different values for development vs production

Troubleshooting

Common Issues:

  1. Missing JWT_SECRET/SESSION_SECRET:

    JWT_SECRET=your-strong-secret-here
    SESSION_SECRET=your-strong-secret-here
  2. Redis connection issues:

    REDIS_URL=redis://localhost:6379
    # Or for demo mode:
    DEMO_MODE=true
    ALLOW_IN_MEMORY_REDIS=true
  3. Database connection issues:

    # For SQLite (local development):
    DATABASE_URL=sqlite:///icc_rules.db
    
    # For PostgreSQL (production):
    DATABASE_URL=postgresql://user:pass@host:port/db?sslmode=require

Support

If you encounter issues:

  1. Check the application logs
  2. Verify all required environment variables are set
  3. Ensure local services (Redis, database) are running
  4. Check the health endpoint: /health

Created: October 13, 2025
Service: icc-rule-engine (srv-d35ovhndiees738g995g)
Status: Environment variables successfully synced to local development