Skip to content

Configuration

rCommerce is configured via a TOML file. Every option has a sensible default.

Config is loaded from (in priority order):

  1. Path specified in RCOMMERCE_CONFIG environment variable
  2. ./config/default.toml
  3. ./config/production.toml
  4. /etc/rcommerce/config.toml
[server]
host = "0.0.0.0" # Bind address
port = 8080 # Listen port
worker_threads = 0 # 0 = use CPU core count
[server.cors]
enabled = true
allowed_origins = ["*"]
allowed_methods = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]
allowed_headers = ["Content-Type", "Authorization"]
[database]
db_type = "Postgres"
host = "localhost"
port = 5432
database = "rcommerce"
username = "rcommerce"
password = "password"
pool_size = 20
[cache]
cache_type = "Memory" # or "Redis"
max_size_mb = 100
redis_url = "redis://localhost:6379"
[security]
api_key_prefix_length = 40
api_key_secret_length = 40
[security.jwt]
secret = "change-this-in-production"
expiry_hours = 24
[payment]
default_gateway = "stripe" # or "airwallex"
test_mode = true
[payment.stripe]
enabled = true
secret_key = "sk_test_..."
publishable_key = "pk_test_..."
[payment.airwallex]
enabled = false
client_id = ""
api_key = ""
demo = true
[shipping]
default_provider = "weight_based"
[shipping.weight_based]
# Zone rates are configured in code
# See Shipping guide for details
[notifications]
enabled = true
[notifications.email]
# Option 1: Postmark
postmark_token = "your-server-token"
from_email = "shop@example.com"
from_name = "Your Store"
# Option 2: SMTP
smtp_host = "smtp.example.com"
smtp_port = 465
smtp_user = "user@example.com"
smtp_pass = "password"
smtp_tls = true
[features]
debug_api = true # Enable debug endpoints
metrics = true # Prometheus metrics
health_check = true # /health endpoint
[tls]
enabled = false
cert_path = "/path/to/cert.pem"
key_path = "/path/to/key.pem"