Home Docs Schema Formats Errors
Conduit

Configuration

Configuration Overview

Conduit loads configuration from JSON, YAML, TOML, or XML files. Configuration controls server behavior, database connections, limits, policies, and optional authorization modules.

Supported Configuration Formats

Conduit can load configuration from:

  • JSON (.json)
  • YAML (.yaml, .yml)
  • TOML (.toml)
  • XML (.xml)

The configuration file is passed using the -c or --config flag:

./conduit --config ./config.yaml

If no path is provided, Conduit searches for:

config.json
config.yaml
config.yml
config.toml
config.xml

Server Configuration

The server section defines host, port, and default limits.

server:
  host: "0.0.0.0"
  port: 8080
  default_limit: 50

default_limit controls the maximum number of rows returned by list endpoints. If omitted or set to a non‑positive value, Conduit defaults to 50.

Database Configuration

The database section defines the driver and connection string.

database:
  driver: "sqlite"
  dsn: "./app.db?_pragma=journal_mode(WAL)&_pragma=busy_timeout(5000)"

Supported drivers:

  • Sqlite — file‑based or in‑memory SQLite
  • memory — in‑memory database for testing
  • PostgreSQL
  • MySQL/MariaDB
  • SQL Server

The DSN is passed directly to the underlying driver.

Policy Configuration

The policy section controls public read/write access.

policy:
  publicReads: true
  publicWrites: true
  publicMutation: true

These flags determine whether unauthenticated clients may perform read or write operations, or mutate schema.

Authorization

The auth section enables optional authorization modules.

auth:
  environmentEnabled: false
  dbEnabled: false

  dbAuth:
    driver: "sqlite"
    dsn: "./auth.db"
    table: "users"
    tokenColumn: "token"
    roleColumn: "role"
    roles:
      admin: "admin"
      readWrite: "rw"
      readOnly: "ro"
    cache:
      capacity: 10000
      ttlSeconds: 300

When dbEnabled is true, Conduit performs token‑based authorization using the configured database table.

Example Full Configuration

server:
  host: "0.0.0.0"
  port: 8080
  default_limit: 50

database:
  driver: "sqlite"
  dsn: "./app.db"

policy:
  publicReads: true
  publicWrites: true
  publicMutation: true

auth:
  environmentEnabled: false
  dbEnabled: false
  dbAuth:
    driver: "sqlite"
    dsn: "./auth.db"
    table: "users"
    tokenColumn: "token"
    roleColumn: "role"
    roles:
      admin: "admin"
      readWrite: "rw"
      readOnly: "ro"
    cache:
      capacity: 10000
      ttlSeconds: 300