DSC
DSC copied to clipboard
DSC meta settings file override
Summary of the new feature / enhancement
As a resource author, I want to quickly and conveniently switch between the settings DSC uses to make testing and development easier without having to update and redefine my settings repeatedly.
Related to and dependent on #282.
Proposed technical implementation details (optional)
DSC commands could support an optional --settings-file flag that uses an alternate meta configuration for that execution. The command(s) for defining the meta configuration could support an optional --path flag that creates/updates the settings data in an alternate location, using the default if not specified.
DSC could also respect the DSC_SETTINGS_FILE environment variable in addition to the command flag:
- If neither the environment variable nor flag are specified for a command, use the default settings file path.
- If the environment variable is defined and the flag isn't specified, use the settings file defined by the environment variable.
- If the command flag is specified, use the settings file it specifies.
- If the specified settings file from env or flag isn't found, error and abort with a specified exit code.
- If the specified settings file isn't valid, error and abort with a specified exit code.
For example:
# Show settings in default file
dsc settings get
# Show settings in dev file
dsc settings get --path ~/dev.dsc.settings.yaml
# Use default settings file
$myConfig | dsc config set
# Use settings in dev file by flag
$myConfig | dsc config set --settings-file ~/dev.dsc.settings.yaml
# Use settings in dev file by env var, then override with ops file:
DSC_SETTINGS_FILE="~/dev.dsc.settings.yaml"
$myConfig | dsc config set
$myConfig | dsc config set --settings-file ~/ops.dsc.settings.yaml