System Proposal: xrpld YAML Configuration File Support
#437
Replies: 5 comments 4 replies
-
|
is this to get away from executing code on start up or to get to a std syntax? honestly the part I would appreciate more as a node operator would be a validation screen with a tree of the config with a confirm -y as currently if one defines a section multiple times you simply over write it (if my memory serves correct, done at least once). if not mistaken a duplicate YAML definition (section) throws an error? |
Beta Was this translation helpful? Give feedback.
-
|
This is an excellent idea ! |
Beta Was this translation helpful? Give feedback.
-
|
Maybe a dinosaur take but YAML is horrific imo. It's so much easier to get it wrong with YAML. Screw it up with a tab or uneven amount of spaces or triple brackets 😵 Only node operator/geeks use it (so config file aesthetics don't matter that much?) and more prone to mistakes. Reliability > aesthetics = keep current format? |
Beta Was this translation helpful? Give feedback.
-
|
Given that the proposal intentionally avoids most advanced YAML features and prioritizes deterministic parsing, TOML may be a better fit than YAML as a structured, typed successor to the existing INI-style configuration, especially for operational safety and long-term maintainability. |
Beta Was this translation helpful? Give feedback.
-
|
That is excellent idea. My two cents, plan not to run it alongside current configuration, but to replace it. Like one year run it along side, one year, deprecate ini, on the third remove ini. But to be honest, this roll out phase could be even quicker. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
System Proposal:
xrpldYAML Configuration File Support1. Abstract
This specification defines YAML as an alternative configuration file format for xrpld, alongside the existing INI-esque format (
rippled.cfgandvalidators.txt). YAML provides a more structured, readable, and maintainable format for complex configuration hierarchies.2. Motivation
The current INI-esque (henceforth referred to as INI, though it technically does not quite match the INI standard) configuration format for xrpld has several limitations:
Flat structure: INI files lack native support for nested configuration, requiring workarounds like the
[server]section referencing separate[port_*]sections.Limited data types: All values are strings, with no distinction between numbers, booleans, or lists.
Verbose list syntax: Lists require either multiple lines or comma-separated values within a single line, which can be difficult to read and maintain.
No standard: INI format lacks a formal specification, leading to parser inconsistencies.
YAML addresses these issues by providing:
3. Specification
3.1 File Detection
xrpld SHALL detect the configuration format based on file extension:
.yamlor.yml(case-insensitive) SHALL be parsed as YAMLThis applies to both the main configuration file and the validators file. YAML files will take precedence over INI files if both are present.
3.2 YAML Schema
The YAML configuration MUST be a mapping (dictionary) at the root level. Each top-level key corresponds to an INI section name.
3.2.1 Scalar Sections
Single-value sections are represented as scalar values:
Equivalent INI:
3.2.2 Mapping Sections
Sections with key-value pairs are represented as nested mappings:
Equivalent INI:
3.2.3 Sequence Sections
Sections with multiple values are represented as sequences:
Equivalent INI:
[validator_list_sites] https://vl.ripple.com https://unl.xrplf.org3.2.4 Server Ports (Nested Structure)
The
serversection supports a nestedportsstructure for improved readability:This is flattened to the equivalent INI structure:
3.2.5 IPs Section
The
ipssection accepts a structured format:3.2.6 Null Values
Null values (
null,~, or empty) result in empty sections:3.3 Conversion Rules
3.4 Error Handling
4. Rationale
4.1 Extension-Based Detection
Using file extension for format detection (rather than content sniffing) provides:
4.2 Nested Port Structure
The nested
server.portsstructure was chosen to demonstrate YAML's advantages while maintaining full compatibility with the existing flat port section approach.5. Backwards Compatibility
This proposal is fully backward compatible:
Further down the line (in a few months), the original INI format may be deprecated.
6. Test Plan
The implementation includes comprehensive unit tests covering:
7. Reference Implementation
A reference implementation is available here.
The reference implementation adds:
xrpld.cfgandvalidators.txt)xrpldto make migration easier8. Security Considerations
8.1 YAML Parsing Safety
The yaml-cpp library is used for parsing. This library:
8.2 No New Attack Surface
Since YAML is converted to the same internal format as INI:
8.3 File Permission Recommendations
Configuration files (YAML or INI) SHOULD have restricted permissions (e.g., 600 or 640) as they may contain sensitive information such as admin credentials.
Appendix
Appendix A: FAQ
A.1: Can I mix YAML and INI files?
Yes. The main configuration file and validators file are detected independently. You could use
xrpld.yamlwithvalidators.txtor vice versa.A.2: How do I migrate from INI to YAML?
Use the provided
cfg/ini2yaml.shscript:Note: The script produces flat YAML. Manual editing may be desired to use nested structures like
server.ports.A.3: Which format should I use?
Either format is fully supported. YAML may be preferable for:
INI may be preferable for:
It is recommended to switch to YAML within a few months, once the format has proved to be safe and free of bugs.
Beta Was this translation helpful? Give feedback.
All reactions