From 5c916a6fb44488b0a3f79bb4b780de4eb0b791bd Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Mon, 28 Nov 2022 10:10:13 +0100 Subject: [PATCH] Store specified environment in configuration for reference (#104) --- bundle/config/bundle.go | 3 +++ bundle/config/mutator/select_environment.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/bundle/config/bundle.go b/bundle/config/bundle.go index ba919669..57a55c2f 100644 --- a/bundle/config/bundle.go +++ b/bundle/config/bundle.go @@ -10,4 +10,7 @@ type Bundle struct { // TODO // Default warehouse to run SQL on. // DefaultWarehouse string `json:"default_warehouse,omitempty"` + + // Environment is set by the mutator that selects the environment. + Environment string `json:"environment,omitempty"` } diff --git a/bundle/config/mutator/select_environment.go b/bundle/config/mutator/select_environment.go index 3b99b456..1ceea4de 100644 --- a/bundle/config/mutator/select_environment.go +++ b/bundle/config/mutator/select_environment.go @@ -38,6 +38,9 @@ func (m *selectEnvironment) Apply(root *config.Root) ([]Mutator, error) { return nil, err } + // Store specified environment in configuration for reference. + root.Bundle.Environment = m.name + // Clear environments after loading. root.Environments = nil return nil, nil