.config.yaml Configuration

.config.yaml Configuration File #

The .config.yaml file is your local development configuration file for tofu. It allows you to customize various settings for your development environment without modifying version-controlled files.

Quick Start #

  1. Create your config file by copying the example:

    cd ~/bonsai
    cp .example.config.yaml .config.yaml
    
  2. The file is gitignored and safe for storing local development credentials

  3. Most sections are optional - only configure what you need

Configuration Sections #

Test Credentials #

Used by Swagger UI and test scripts for authentication:

test:
  # Clerk test user credentials for Swagger UI authentication
  clerk_user_id: user_2tU2uWZWPobyhGgNj6QGaZvJjl0
  clerk_org_id: org_2yG5SsBiMlSrwDJVBpofU0u8nR5

Usage:

  • These values are automatically loaded by Swagger UI for API testing
  • Set by override-coder-env.sh during mise run dev
  • Get these from your Clerk dashboard or use shared test credentials

Related Documentation:

Database Seed Configuration #

Controls the mise db-seed command for generating test data:

seed:
  # Entity selection (leave empty for interactive selection)
  entity_id: ""

  # Document page ID (leave empty to auto-detect)
  document_page_id: ""

  # Number of extractions per type
  counts:
    ap_bill: 50
    ar_invoice: 50
    bank_statement: 20
    ap_credit_note: 10
    ar_credit_note: 10
    direct_expense: 20

  # Date range for timestamps (days ago from now)
  date_range:
    min_days_ago: 30
    max_days_ago: 1

  # Status distribution (percentages, must sum to 100)
  status_distribution:
    VERIFIED: 60
    NEEDS_REVIEW: 25
    REVIEW_LATER: 10
    PENDING: 5

  # Weighted currency selection
  currencies:
    - code: USD
      weight: 50
    - code: JPY
      weight: 30
    - code: EUR
      weight: 10
    - code: GBP
      weight: 10

  # Number of data records per extraction
  data_count:
    min: 1
    max: 10

  # Number of line items per extraction
  line_items:
    min: 1
    max: 100

  # Number of sync activities per data record
  sync_activities:
    min: 0
    max: 3

Usage:

  • All values are optional - CLI flags override these defaults
  • Run mise db-seed to use these settings
  • Run mise db-seed --help to see CLI override options

Example Workflows:

# Use config file defaults
mise db-seed

# Override specific counts
mise db-seed --ap-bills 100 --ar-invoices 200

# Seed specific entity without prompts
mise db-seed -e <entity-uuid> -y

Related Documentation:

Integration Webhook Credentials #

Credentials for external integrations (Xero, QuickBooks, Stripe, etc.):

# Xero Integration
xero:
  client_id: ""
  client_secret: ""
  webhook_signing_key: ""

# QuickBooks Online Integration
qbo:
  client_id: ""
  client_secret: ""
  verifier_token: ""

# Zoho Integration
zoho:
  client_id: ""
  client_secret: ""

# Sage Integration
sage:
  client_id: ""
  client_secret: ""

# Clerk Webhook
clerk:
  webhook_signing_secret: ""

# Stripe Integration
stripe:
  secret_key: ""
  webhook_signing_secret: ""

# SharePoint Integration
sharepoint:
  client_id: ""
  client_secret: ""
  tenant_id: ""

# Google Drive Integration
google:
  api_key: ""
  client_id: ""
  client_secret: ""

# OpenAI workload identity, used when OPENAI_API_KEY is unset (the workspace also needs an AWS role OpenAI trusts)
openai:
  identity_provider_id: ""
  service_account_id: ""

# Anthropic workload identity, used when ANTHROPIC_API_KEY is unset (same AWS role requirement)
anthropic:
  federation_rule_id: ""
  organization_id: ""
  service_account_id: ""
  workspace_id: ""

# Vertex AI (Gemini) workload identity, used when no Gemini API key is set (same AWS role requirement)
vertex:
  project: ""
  workload_identity_provider: ""
  service_account: ""

Usage:

  • Managed via the app-config-web UI at http://localhost:8888
  • Or manually edit this file directly
  • These values override Doppler secrets for local webhook testing
  • Applied automatically by override-coder-env.sh during mise run dev

How it works:

  1. Start dev environment: mise run dev
  2. override-coder-env.sh reads .config.yaml
  3. Applies these credentials to .env file
  4. Services start with your local credentials

UI Management:

For easier credential management, use the web UI:

cd tools/app-config-web
./start.sh
# Access at http://localhost:8888

Related Documentation:

Latency Emulation #

Holds each BonsAPI call the webapp and tofu-web dev servers make through their generated clients until a latency sampled from that route’s production p50/p90/p99, so loading states show up in dev, against a local BonsAPI or the remote dev one:

latency_emulation:
  enabled: true
  scale: 1.0 # multiplier on production latency

mise run dev, mise run webapp-dev and mise preview write it into .env as NEXT_PUBLIC_LATENCY_EMULATION_SCALE; LATENCY_EMULATION=true|false in the shell overrides enabled. After changing it, run mise run down and then that command again, since frontends already serving keep their old setting. The profile is libs/typescript/utils/src/latency-profile.json (last 30 days from Datadog, gitignored); those commands pull it when it is missing and mise run latency-profile-pull refreshes it. Calls already slower than the sample and routes missing from the profile are not delayed, and builds without the setting leave the helper and profile out.

Configuration Precedence #

Settings are applied in this order (later overrides earlier):

  1. Doppler secrets (production values from Doppler)
  2. .config.yaml (your local overrides)
  3. CLI flags (for mise db-seed commands)
  4. Environment variables (manual overrides)

File Location #

The config file must be located at the repository root:

~/bonsai/.config.yaml

Do not rename or move this file - it’s referenced by multiple scripts and tools.

Security Notes #

  • The file is gitignored - it will never be committed to version control
  • Safe for storing development credentials and API keys
  • Only used in local development and Coder workspaces
  • Never contains production credentials (use Doppler for production)

Troubleshooting #

Config file not found #

If tools report missing config file:

cd ~/bonsai
cp .example.config.yaml .config.yaml

Credentials not applied #

If webhook credentials aren’t working:

  1. Verify .config.yaml has the correct values

  2. Restart services to apply changes:

    docker compose restart bonsapi webapp
    
  3. Or re-run the override script:

    ./tools/coder/scripts/override-coder-env.sh .env
    

Seed settings ignored #

If mise db-seed isn’t using your config:

  • Check that .config.yaml has a seed: section
  • CLI flags override config file values
  • Verify YAML syntax is correct (indentation matters!)
  • .example.config.yaml - Template with all available options
  • tools/coder/scripts/override-coder-env.sh - Script that applies config to .env
  • tools/seed/seed.sh - Database seeding tool that reads config
  • tools/app-config-web/ - Web UI for managing credentials