Configuration Guide

Table of Contents

Overview

This guide explains how to configure the application for development, testing, and production environments. You can customize settings using environment variables, YAML/JSON files, or command‑line arguments.

Environment Variables

Set the following variables to control runtime behavior:

# .env example
APP_ENV=production
APP_DEBUG=false
DATABASE_URL=postgres://user:pass@db.example.com:5432/appdb
CACHE_DRIVER=redis
REDIS_URL=redis://redis.example.com:6379/0

Configuration Files

Configuration can also be provided via config.yaml or config.json. The YAML format is preferred for readability.

# config.yaml
app:
  name: MyApp
  version: 1.4.2
  locale: en_US

database:
  driver: postgresql
  host: db.example.com
  port: 5432
  name: appdb
  username: user
  password: pass

cache:
  driver: redis
  host: redis.example.com
  port: 6379
  db: 0

Command‑Line Options

Overrides can be passed directly when starting the service:

# start the service with custom options
myapp --env=development --debug=true --config=/path/to/custom.yaml

Advanced Settings

For fine‑grained control, use the advanced.yaml file to configure logging, security, and feature toggles.

# advanced.yaml
logging:
  level: INFO
  file: /var/log/myapp.log

security:
  csrf_protection: true
  content_security_policy: "default-src 'self'"

features:
  beta_mode: false
  experimental_api: true

Troubleshooting

For additional help, see the Troubleshooting Guide.