FsConfig
FsConfig copied to clipboard
Consecutive defaults
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?
@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.