# Intacct API Usage - Environment Variables Sample
# Copy this file to .env and update the values for your environment

# ============================================
# Directory Paths
# ============================================
# These directories are used for data storage and logs.
# For Docker deployments, these are typically mounted as volumes.
# For local development, set these to your preferred locations.

# Windows format:
# DATA_DIR=E:\DockerVolumes\IntacctAPIUsage\data
# LOG_DIR=E:\DockerVolumes\IntacctAPIUsage\logs

# Linux/Mac format:
# DATA_DIR=/path/to/data
# LOG_DIR=/path/to/logs

# If not set, defaults to subdirectories in the project folder:
# - ./data (SQLite database with config, credentials, companies, and API usage data)
# - ./logs (application logs)

DATA_DIR=
LOG_DIR=

# ============================================
# Server Configuration
# ============================================

# Port the server listens on (default: 5050)
PORT=5050

# Node environment (development, production)
NODE_ENV=development

# ============================================
# Logging Configuration
# ============================================

# Log level: error, warn, info, debug (default: info)
# Controls both the server/winston logger and CLI job output:
# info  = basic progress (companies, stored records, summary)
# debug = verbose output (queries, page counts, prefix filtering, sample data)
LOG_LEVEL=info

# ============================================
# Security Configuration
# ============================================

# Encryption key for credentials storage (REQUIRED)
# This key is used to encrypt/decrypt saved Intacct credentials.
# Generate a secure random key using:
#   node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
#
# IMPORTANT:
# - Keep this key secret and secure
# - Use the same key across restarts to access saved credentials
# - If you lose this key, saved credentials cannot be recovered
# - For Docker: also set this in docker-compose.yml or pass via -e flag

ENCRYPTION_KEY=

# ============================================
# Local Companies API (Testing Only)
# ============================================
# These settings enable a local companies API endpoint for testing
# the API-based company loading feature before connecting to the real API.
#
# When enabled, the /companies/all endpoint returns companies from
# JSON files in the DATA_DIR that contain a "companies" array.

# Enable the local companies API (default: disabled)
# Set to true or 1 to enable the /companies endpoints
# Add json file to DATA_DIR folder 
LOCAL_COMPANIES_API_ENABLED=

# Token for local companies API authentication (optional)
# If set, requests must include: Authorization: Bearer <token>
# Leave empty to allow unauthenticated access when enabled
LOCAL_COMPANIES_API_TOKEN=

# ============================================
# Authentication
# ============================================
# Access key for the web UI login screen.
# When set, users must enter this key to access the application.
# If empty or not set, no login is required and the app is open.
# For Docker: also set this in docker-compose.yml or pass via -e flag

AUTH_KEY=
