Stabilize the logic for setting-alias conflicts [#66]
This includes a refactor to the way aliases are processed. I had been thinking in terms of locking down the aliases names pretty tightly, in order to provide an error if there are conflicts. After discussion with @josmo, though, it seems like we can do it the same way we do for "PLUGIN_"/non-prefixed variables, i.e. quietly override them.
This commit is contained in:
@@ -105,6 +105,16 @@ func (suite *ConfigTestSuite) TestNewConfigWithAliases() {
|
||||
suite.Equal("d2l0aCBpdHMgaGVhZA==", cfg.Certificate, "Certificate should be aliased")
|
||||
}
|
||||
|
||||
func (suite *ConfigTestSuite) TestNewConfigWithAliasConflicts() {
|
||||
suite.unsetenv("FORCE")
|
||||
suite.setenv("PLUGIN_FORCE_UPGRADE", "true")
|
||||
suite.setenv("PLUGIN_FORCE", "false") // should override even when set to the zero value
|
||||
|
||||
cfg, err := NewConfig(&strings.Builder{}, &strings.Builder{})
|
||||
suite.NoError(err)
|
||||
suite.False(cfg.Force, "official names should override alias names")
|
||||
}
|
||||
|
||||
func (suite *ConfigTestSuite) TestNewConfigSetsWriters() {
|
||||
stdout := &strings.Builder{}
|
||||
stderr := &strings.Builder{}
|
||||
|
||||
Reference in New Issue
Block a user