diff --git a/bundle/config/root.go b/bundle/config/root.go index b92d85bbf1..28333e988a 100644 --- a/bundle/config/root.go +++ b/bundle/config/root.go @@ -78,6 +78,9 @@ func (r *Root) SetConfigFilePath(path string) { r.Resources.SetConfigFilePath(path) if r.Environments != nil { for _, env := range r.Environments { + if env == nil { + continue + } if env.Resources != nil { env.Resources.SetConfigFilePath(path) } diff --git a/bundle/tests/environment_empty/bundle.yml b/bundle/tests/environment_empty/bundle.yml new file mode 100644 index 0000000000..17c03c8dcb --- /dev/null +++ b/bundle/tests/environment_empty/bundle.yml @@ -0,0 +1,5 @@ +bundle: + name: environment_empty + +environments: + development: diff --git a/bundle/tests/environment_empty_test.go b/bundle/tests/environment_empty_test.go new file mode 100644 index 0000000000..fb2e334166 --- /dev/null +++ b/bundle/tests/environment_empty_test.go @@ -0,0 +1,12 @@ +package config_tests + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestEnvironmentEmpty(t *testing.T) { + b := loadEnvironment(t, "./environment_empty", "development") + assert.Equal(t, "development", b.Config.Bundle.Environment) +}