PoshCode / Configuration

A module to help other modules have settings
MIT License
176 stars 27 forks source link

We need to load all relevant files and let them override each other #2

Closed Jaykul closed 7 years ago

Jaykul commented 9 years ago
Feature: Multiple settings files should layer
As a module author, I want to distribute a default config with my module
As a machine administrator, I want to save corporate defaults
As a user I want to save my own preferences
And our custom settings shouldn't be overwritten on upgrade

Scenario: Save shouldn't overwrite default settings
Given MyModule has Config.psd1 default settings file
When I save the configuration
The settings should not overwrite the default file

Scenario: Load should layer settings (and support new settings after upgrades)
Given MyModule has Config.psd1 default settings file
And I set some settings in the LocalMachine 
And I set some settings in the CurrentUser
When I loading the settings
Then CurrentUser settings should overwrite LocalMachine settings
And LocalMachine settings should overwrite default settings
But default settings should still be read, just in case

Scenario: Migrate settings only once
Given MyModule has a new version
And I have some settings from an old version
When I load the settings in the new module
Then the settings from the old version should be copied
And MyModule should be able to migrate them
But they should save only to the new version
Jaykul commented 7 years ago

All of this is long done (and the scenarios copied into various feature files), with the exception of automatic migration of settings from versions -- instead, settings are versioned manually (rather than based on the module version), and it's up to the module author to do the migration when they change the module version number. I need to write some guidance on that, but I'm not leaving this ticket open for that.