# Configuration System URL: /bengal/docs/0.5.1/reference/architecture/tooling/config/ Section: tooling -------------------------------------------------------------------------------- Configuration System Bengal provides flexible, format-agnostic configuration with clear architectural boundaries. Three-Layer Architecture Layer File Purpose Template Access Identity site.yaml Title, author, menus, taxonomies Bengal Processing content.yaml Excerpt length, TOC depth, sorting <p>Bengal provides flexible, format-agnostic configuration with clear architectural boundaries.</p> <h2 id="three-layer-architecture">Three-Layer Architecture</h2> <div class="table-wrapper"><table> <thead> <tr> <th>Layer</th> <th>File</th> <th>Purpose</th> <th>Template Access</th> </tr> </thead> <tbody> <tr> <td><strong>Identity</strong></td> <td><code>site.yaml</code></td> <td>...</td> </tr> </tbody> </table></div> Variables params.yaml Custom user data {{ site.config.params.* }} Config Detection Bengal auto-detects configuration files in order: bengal.toml / bengal.yaml / bengal.yml config/ directory structure Directory Structure (Recommended) config/ ├── _default/ │ ├── site.yaml # Identity │ ├── content.yaml # Processing │ ├── params.yaml # Variables │ └── build.yaml # Build settings ├── environments/ │ ├── local.yaml # Dev overrides │ └── production.yaml └── profiles/ ├── writer.yaml # Fast builds, quiet output └── dev.yaml # Full observability Example Configuration # config/_default/site.yaml site: title: "My Site" baseurl: "https://example.com" menu: main: - name: "Home" url: "/" # config/_default/content.yaml content: excerpt_length: 200 # → page.excerpt reading_speed: 200 # → page.reading_time (words per minute) toc_depth: 4 # → page.toc sort_pages_by: "weight" # config/_default/params.yaml params: product_name: "Bengal" version: "1.0.0" Environment Detection Bengal auto-detects deployment environments: Platform Detection Environment Netlify NETLIFY=true CONTEXT value Vercel VERCEL=1 VERCEL_ENV value GitHub Actions GITHUB_ACTIONS=true production Manual BENGAL_ENV=<env> Explicit override Default — local bengal build --environment production bengal serve --environment local # Default for serve Build Profiles bengal build --profile writer # Fast builds, quiet output bengal build --profile dev # Full observability Configuration Precedence Merged lowest to highest: config/_default/*.yaml config/environments/<env>.yaml config/profiles/<profile>.yaml Environment variable overrides CLI Commands bengal config show # Show merged config bengal config show --origin # Show which file contributed each key bengal config doctor # Diagnose issues bengal config diff --against production # Compare local vs production bengal config init # Initialize directory structure Content Processing Settings Setting Affects Template Access excerpt_length page.excerpt <p>Bengal provides flexible, format-agnostic configuration with clear architectural boundaries.</p> <h2 id="three-layer-architecture">Three-Layer Architecture</h2> <div class="table-wrapper"><table> <thead> <tr> <th>Layer</th> <th>File</th> <th>Purpose</th> <th>Template Access</th> </tr> </thead> <tbody> <tr> <td><strong>Identity</strong></td> <td><code>site.yaml</code></td> <td>...</td> </tr> </tbody> </table></div> reading_speed page.reading_time 2 toc_depth page.toc {{ page.toc | safe }} related_count page.related_posts {% for p in page.related_posts %} default_type Section type detection (internal) sort_pages_by section.pages order {% for p in section.pages %} Usage from pathlib import Path from bengal.config import ConfigLoader loader = ConfigLoader(Path(".")) config = loader.load() # Auto-detect from site root # Or load a specific file config = loader.load(Path("bengal.yaml")) # Access flattened config (site.title → title) title = config["title"] parallel = config["parallel"] -------------------------------------------------------------------------------- Metadata: - Author: lbliii - Word Count: 413 - Reading Time: 2 minutes