Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consecutive defaults #27

Open
Slesa opened this issue Feb 3, 2023 · 1 comment
Open

Consecutive defaults #27

Slesa opened this issue Feb 3, 2023 · 1 comment

Comments

@Slesa
Copy link

Slesa commented Feb 3, 2023

When working with configurations, sometimes they get overwritten depending on the origin. The order of the defaulting is discussable, but I think it is

  • read environment vars
  • read configuration file 1, maybe from server
  • read local configuration file
  • read arguments

and of course starting with settings that the programmer considers perfect as defaults.

type Settings { showAsWindow: bool; windowXsize: int; windowYsize: int }
let DefaultSettings = { true; 1024; 768 }

wouldn't it be nice to have a configuration chain like

let setup = DefaultSettings
|> EnvConfig.Get<Settings>
|> IniConfig.Get<Settings>
|> ArgConfig.Get<Settings>

Is this possible somehow?

@queil
Copy link
Collaborator

queil commented Feb 6, 2023

@Slesa I think you can achieve similar behaviour via IConfigurationRoot/ConfigurationBuilder support. Otherwise I think the lib would require some code changes (PRs welcome) to provide such a composability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants