Principle:AFK surf Open agent Declarative Configuration
| Knowledge Sources | |
|---|---|
| Domains | Deployment, Configuration, Self_Hosting |
| Last Updated | 2026-10-25 00:00 GMT |
Overview
Pattern of driving an application's runtime behavior from a single declarative config file validated against a formal JSON Schema, with empty defaults for unused features.
Description
A self-hosted app externalizes its secrets and provider choices into a single config.json (derived from a shipped template) rather than scattering them across environment variables. The config is validated against a JSON Schema (schema.json) referenced by a "$schema" pointer, which enables editor validation and autocomplete. The schema covers OAuth providers, mailer, AI copilot providers, storage, and integration keys. Unused features are left as empty defaults rather than removed, so the schema shape stays stable. The file is bind-mounted into the container, so changing it requires no image rebuild — only a container restart.
Usage
Apply this principle when an app has many optional integrations (multiple AI providers, OAuth providers, storage backends) and you want operators to enable only what they need without touching code or environment sprawl. Ship a template with empty defaults and a schema for validation.
Theoretical Basis
The config is a typed document: Config : JSON ∧ Schema. The "$schema" pointer binds the document to its validator; editor tooling reads the schema for autocomplete and inline validation. Empty defaults make optional features explicit; the app treats an empty string as "not configured" rather than failing. Bind-mounting decouples config from image.
Pseudo-code:
{
"$schema": "./schema.json",
"copilot": { "enabled": true, "providers.openai": { "apiKey": "sk-..." } }
}