DSC
DSC copied to clipboard
DSC meta configuration
Summary of the new feature / enhancement
As a user, I want to define default behaviors/options for
dsc
so that I don't need to pass the options to every invocation or define a function to do so for me.
Right now, there's no persistent way for a user to control how dsc
behaves except for the DSC_RESOURCE_PATH
environmental variable. Users may want to set the default output format for DSC to pretty-json, or only use manifests that have been signed, or disable specific providers (see #274).
As the options for how dsc
should behave expand, these needs will compound - consider the WhatIf
scenario, whether to pre-check for permissions, etc.
Proposed technical implementation details (optional)
I haven't done much research on the available options for rust applications, but in an ideal world, we could borrow (a subset of) the functionality that viper has, supporting layered overrides, where each item in the following list takes precedence over the item below it:
- Explicitly defined flag option, like
--format
- Environment variable value, like
DSC_FORMAT
- Configuration file key value, like
format
- Lookup from a key-value store, like consul or etcd (I think this is out of scope, included for completeness)
- Defined defaults in the code
Even if we only supported flags and environment variables, I think we'd have a more manageable UX. We could implement the configuration file handling later, if ever. With support for using environment variables as default options, users could use .env
files as lightweight configuration, or set the variables in their CI jobs, or whatever makes sense for their context.