Proposal: Migrate Configuration Format from YAML to TOML #633
renuka-fernando
started this conversation in
General
Replies: 1 comment
-
|
+1 for the idea. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
This proposal discusses migrating our gateway configuration from YAML to TOML format. The primary motivation is to improve configuration maintainability and reduce indentation-related errors.
Current State
Our configuration file (
gateway/configs/config.yaml) is a 364-line YAML file with deep nesting (up to 4-5 levels). Key sections include:gateway_controller.servergateway_controller.policyserver.tlsgateway_controller.router.downstream_tlsgateway_controller.router.policy_engine.tlspolicy_engine.xds.tlsanalytics.publishers[].settingsProblems with Current YAML Configuration
1. Indentation Sensitivity
YAML's strict indentation requirements make configuration error-prone. A single misaligned space can cause:
Example from our config:
2. Copy-Paste Friction
When adding new configuration sections, users must:
This is particularly problematic when copying configuration examples from documentation.
3. Implicit Type Conversion
YAML silently converts values based on content, which can cause unexpected behavior:
Our config has several values that could be misinterpreted (ports, timeouts, versions).
4. Deep Nesting Becomes Unreadable
Current nesting example:
Users must trace 4 levels of indentation to understand the context.
Proposed Solution: TOML
What is TOML?
TOML (Tom's Obvious, Minimal Language) is a configuration format designed to be:
It's used by modern tools including Cargo (Rust),
pyproject.toml(Python), Hugo, and many Go projects.Benefits of TOML
1. Indentation Independence
Copy-paste anywhere - Users can add configuration sections without worrying about indentation:
Indentation is purely cosmetic and ignored by the parser.
2. Explicit Section Headers
Clear visual separation between configuration sections:
3. Type Safety
TOML requires explicit syntax for types:
4. Easier Navigation
Section headers act as natural anchors. Users can search for
[gateway_controller.router.policy_engine]directly instead of counting indentation levels.5. Better Tooling Support
github.com/BurntSushi/toml,github.com/pelletier/go-toml)Example: Current YAML vs Proposed TOML
Current YAML:
Proposed TOML:
Handling Arrays (e.g., Publishers)
Current YAML:
Proposed TOML:
Considerations
Potential Drawbacks
Implementation Notes
koanf/parsers/tomlReferences
Beta Was this translation helpful? Give feedback.
All reactions