Skip to content

Commit

Permalink
fix(vault): consider vault flags (#4486)
Browse files Browse the repository at this point in the history
* fix(vault): consider vault flags

* fix problem introduced with merge conflict resolution

---------

Co-authored-by: Jk1484 <[email protected]>
  • Loading branch information
OliverNocon and Jk1484 authored Jun 3, 2024
1 parent 3e86491 commit 22ff571
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ func (c *Config) GetStepConfig(flagValues map[string]interface{}, paramJSON stri

// merge command line flags
if flagValues != nil {
stepConfig.mixIn(flagValues, filters.Parameters, metadata)
flagFilter := append(filters.Parameters, vaultFilter...)
stepConfig.mixIn(flagValues, flagFilter, metadata)
}

if verbose, ok := stepConfig.Config["verbose"].(bool); ok && verbose {
Expand Down Expand Up @@ -325,7 +326,6 @@ func GetStepConfigWithJSON(flagValues map[string]interface{}, stepConfigJSON str
}

func (c *Config) GetStageConfig(paramJSON string, configuration io.ReadCloser, defaults []io.ReadCloser, ignoreCustomDefaults bool, acceptedParams []string, stageName string) (StepConfig, error) {

filters := StepFilters{
General: acceptedParams,
Steps: []string{},
Expand All @@ -338,7 +338,6 @@ func (c *Config) GetStageConfig(paramJSON string, configuration io.ReadCloser, d

// GetJSON returns JSON representation of an object
func GetJSON(data interface{}) (string, error) {

result, err := json.Marshal(data)
if err != nil {
return "", errors.Wrapf(err, "error marshalling json: %v", err)
Expand All @@ -348,7 +347,6 @@ func GetJSON(data interface{}) (string, error) {

// GetYAML returns YAML representation of an object
func GetYAML(data interface{}) (string, error) {

result, err := yaml.Marshal(data)
if err != nil {
return "", errors.Wrapf(err, "error marshalling yaml: %v", err)
Expand All @@ -370,7 +368,6 @@ func OpenPiperFile(name string, accessTokens map[string]string) (io.ReadCloser,
}

func httpReadFile(name string, accessTokens map[string]string) (io.ReadCloser, error) {

u, err := url.Parse(name)
if err != nil {
return nil, fmt.Errorf("failed to read url: %w", err)
Expand Down Expand Up @@ -409,7 +406,6 @@ func envValues(filter []string) map[string]interface{} {
}

func (s *StepConfig) mixIn(mergeData map[string]interface{}, filter []string, metadata StepData) {

if s.Config == nil {
s.Config = map[string]interface{}{}
}
Expand All @@ -418,7 +414,6 @@ func (s *StepConfig) mixIn(mergeData map[string]interface{}, filter []string, me
}

func (s *StepConfig) mixInHookConfig(mergeData map[string]interface{}, metadata StepData) {

if s.HookConfig == nil {
s.HookConfig = map[string]interface{}{}
}
Expand Down Expand Up @@ -487,7 +482,6 @@ func filterMap(data map[string]interface{}, filter []string) map[string]interfac
}

func merge(base, overlay map[string]interface{}, metadata StepData) map[string]interface{} {

result := map[string]interface{}{}

if base == nil {
Expand Down

0 comments on commit 22ff571

Please sign in to comment.