feat(config): add named config instances API #261

Open
johnride wants to merge 1 commits from feat/named-config-instances into master
Owner

Adds get_named/set_named/get_or_prompt_named to ConfigManager so
multiple instances of the same config type can coexist (e.g., separate
API credentials for primary and backup of a firewall pair).

Key format: {T::KEY}/{instance_name}. EnvSource maps slashes and
hyphens to underscores so the env var name remains valid (e.g.,
HARMONY_CONFIG_TestConfig_fw_primary). LocalFileSource creates
parent directories for nested keys.

The firewall_pair.rs TODO comment is updated to reference the new
API; the actual migration is deferred until Config is implemented
on the credential types.

Adds get_named/set_named/get_or_prompt_named to ConfigManager so multiple instances of the same config type can coexist (e.g., separate API credentials for primary and backup of a firewall pair). Key format: {T::KEY}/{instance_name}. EnvSource maps slashes and hyphens to underscores so the env var name remains valid (e.g., HARMONY_CONFIG_TestConfig_fw_primary). LocalFileSource creates parent directories for nested keys. The firewall_pair.rs TODO comment is updated to reference the new API; the actual migration is deferred until Config is implemented on the credential types.
johnride added 1 commit 2026-04-10 15:23:10 +00:00
feat(config): add named config instances API
Some checks failed
Run Check Script / check (pull_request) Failing after 29s
2f9fb83316
Adds get_named/set_named/get_or_prompt_named to ConfigManager so
multiple instances of the same config type can coexist (e.g., separate
API credentials for primary and backup of a firewall pair).

Key format: {T::KEY}/{instance_name}. EnvSource maps slashes and
hyphens to underscores so the env var name remains valid (e.g.,
HARMONY_CONFIG_TestConfig_fw_primary). LocalFileSource creates
parent directories for nested keys.

The firewall_pair.rs TODO comment is updated to reference the new
API; the actual migration is deferred until Config is implemented
on the credential types.
Author
Owner

I think this should converge to a single opinionated way, either we are named or we're not. I think named only would be better, but the name should be a strong type that restricts the name to only acceptable values (alphanumeric 1-100 characters maybe?) . I don`t think it's complicated at all, actually very simple, but has to be robust. Maybe we could treat the no-name variant as the default?

It would be practical but we need to keep in mind that it has to be obvious when debugging where the value comes from exactly. this can get messy fast with overrides and defaults everywhere.

I think this should converge to a single opinionated way, either we are named or we're not. I think named only would be better, but the name should be a strong type that restricts the name to only acceptable values (alphanumeric 1-100 characters maybe?) . I don`t think it's complicated at all, actually very simple, but has to be robust. Maybe we could treat the no-name variant as the default? It would be practical but we need to keep in mind that it has to be obvious when debugging where the value comes from exactly. this can get messy fast with overrides and defaults everywhere.
Some checks failed
Run Check Script / check (pull_request) Failing after 29s
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/named-config-instances:feat/named-config-instances
git checkout feat/named-config-instances
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NationTech/harmony#261
No description provided.