Skip to content

Commit 22ff571

Browse files
OliverNoconJk1484
andauthored
fix(vault): consider vault flags (#4486)
* fix(vault): consider vault flags * fix problem introduced with merge conflict resolution --------- Co-authored-by: Jk1484 <[email protected]>
1 parent 3e86491 commit 22ff571

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

pkg/config/config.go

+2-8
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ func (c *Config) GetStepConfig(flagValues map[string]interface{}, paramJSON stri
236236

237237
// merge command line flags
238238
if flagValues != nil {
239-
stepConfig.mixIn(flagValues, filters.Parameters, metadata)
239+
flagFilter := append(filters.Parameters, vaultFilter...)
240+
stepConfig.mixIn(flagValues, flagFilter, metadata)
240241
}
241242

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

327328
func (c *Config) GetStageConfig(paramJSON string, configuration io.ReadCloser, defaults []io.ReadCloser, ignoreCustomDefaults bool, acceptedParams []string, stageName string) (StepConfig, error) {
328-
329329
filters := StepFilters{
330330
General: acceptedParams,
331331
Steps: []string{},
@@ -338,7 +338,6 @@ func (c *Config) GetStageConfig(paramJSON string, configuration io.ReadCloser, d
338338

339339
// GetJSON returns JSON representation of an object
340340
func GetJSON(data interface{}) (string, error) {
341-
342341
result, err := json.Marshal(data)
343342
if err != nil {
344343
return "", errors.Wrapf(err, "error marshalling json: %v", err)
@@ -348,7 +347,6 @@ func GetJSON(data interface{}) (string, error) {
348347

349348
// GetYAML returns YAML representation of an object
350349
func GetYAML(data interface{}) (string, error) {
351-
352350
result, err := yaml.Marshal(data)
353351
if err != nil {
354352
return "", errors.Wrapf(err, "error marshalling yaml: %v", err)
@@ -370,7 +368,6 @@ func OpenPiperFile(name string, accessTokens map[string]string) (io.ReadCloser,
370368
}
371369

372370
func httpReadFile(name string, accessTokens map[string]string) (io.ReadCloser, error) {
373-
374371
u, err := url.Parse(name)
375372
if err != nil {
376373
return nil, fmt.Errorf("failed to read url: %w", err)
@@ -409,7 +406,6 @@ func envValues(filter []string) map[string]interface{} {
409406
}
410407

411408
func (s *StepConfig) mixIn(mergeData map[string]interface{}, filter []string, metadata StepData) {
412-
413409
if s.Config == nil {
414410
s.Config = map[string]interface{}{}
415411
}
@@ -418,7 +414,6 @@ func (s *StepConfig) mixIn(mergeData map[string]interface{}, filter []string, me
418414
}
419415

420416
func (s *StepConfig) mixInHookConfig(mergeData map[string]interface{}, metadata StepData) {
421-
422417
if s.HookConfig == nil {
423418
s.HookConfig = map[string]interface{}{}
424419
}
@@ -487,7 +482,6 @@ func filterMap(data map[string]interface{}, filter []string) map[string]interfac
487482
}
488483

489484
func merge(base, overlay map[string]interface{}, metadata StepData) map[string]interface{} {
490-
491485
result := map[string]interface{}{}
492486

493487
if base == nil {

0 commit comments

Comments
 (0)