rust-cli / rust-cli/config-rs

Re-thinking: Layering of configuration

Open
#324 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

E-help-wanted
Dominant language
Rust
Stars
3.2k
Forks
265
Avg merge
2h 42m
Merged PRs (30d)
4

Description

We currently (as of 0.13.x) support layering of configuration objects to merge configuration values.

This should be supported in the future as well.


Re-Thinking the layering mechanism

We might re-think the idea of layering a bit here.
Right now (AFAICR) the layering is executed on loading of the configuration. In future, we might implement this as an operation that happens on accessing the values.
This way, we would always keep all values from the sources and only "merge" the values when accessing a certain element.

Example:

# 1.toml
foo = 1
bar = 2
# 2.toml
bar = 3
// pseudo code:
Build config object
Register "1.toml"
Register "2.toml"
Access config at "bar"
  - Mechanism finds out that "bar" is from "2.toml" and its value is 3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing configuration-layering implementation and reading how configuration objects are loaded and accessed. Use the 1.toml and 2.toml example to define the intended behavior, including bar resolving to 3 while preserving the source values. Done means the future layering approach is specified and its behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.