aboutsummaryrefslogtreecommitdiffstats
path: root/src/config/mod.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-19 16:18:16 +0000
committertv <tv@krebsco.de>2026-11-19 17:36:15 +0100
commit9784111bd3b95be5352669b74e174920c101f349 (patch)
treef443549f96da3d58f4c7e4d9f56b58dcf4af8fa2 /src/config/mod.rs
parent9d3350f996ddba2a8e4636dd3705d9bd1c7aa4fb (diff)
continuum-party: a directory for each federation, the only one used unasked
A party named its node, key and record on every command, or a file of them with --config; one voting in several federations kept files apart by hand. Without --config, the client now reads a federation's own directory, `continuum/federations/NAME` in $XDG_CONFIG_HOME or ~/.config: its `party.toml` of the client's options, its record (`record`) and, where there, its key (`key`); options on the command line, or `record` and `key` in `party.toml`, win. `--federation NAME` chooses one; where there is only one, it is used without being named; where there are several, the client says which there are and asks for one. `root`, `judge` and `twice`, using no options, read none. `init --federation NAME` begins a federation's directory, only its owner reading it, its `party.toml` holding the options given on the command line with it (`node`, `token`, `key`, the key's path made absolute; the node's default left out), and the record in it.
Diffstat (limited to 'src/config/mod.rs')
-rw-r--r--src/config/mod.rs24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 0ed22a2..87f53ba 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -2150,11 +2150,25 @@ pub(crate) fn merged(
matches: &ArgMatches,
options: &'static [OptionSpec],
) -> Result<(Layer, Vec<PathBuf>)> {
- let files: Vec<PathBuf> = matches
- .get_many::<String>(CONFIG)
- .into_iter()
- .flatten()
- .map(PathBuf::from)
+ merged_with(matches, options, &[])
+}
+
+/// As `merged`, the files `first` read before those `matches` names, which win over them.
+pub(crate) fn merged_with(
+ matches: &ArgMatches,
+ options: &'static [OptionSpec],
+ first: &[PathBuf],
+) -> Result<(Layer, Vec<PathBuf>)> {
+ let files: Vec<PathBuf> = first
+ .iter()
+ .cloned()
+ .chain(
+ matches
+ .get_many::<String>(CONFIG)
+ .into_iter()
+ .flatten()
+ .map(PathBuf::from),
+ )
.collect();
let mut merged = Layer::new();
for path in &files {