Skip to content

Commit

Permalink
Prefer envar over parameter
Browse files Browse the repository at this point in the history
Took 2 minutes
  • Loading branch information
tdabasinskas committed Jan 5, 2024
1 parent 71c6b25 commit c57fb0f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions backstage/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ func (p *backstageProvider) Configure(ctx context.Context, req provider.Configur
}

headers := make(map[string]string)
if !config.Headers.IsNull() {
for k, v := range config.Headers.Elements() {
headers[k] = v.String()
if headersEnv := os.Getenv(envHeaders); headersEnv != "" {
for _, kv := range regexp.MustCompile(`(.*?)=([^=]*)(?:,|$)`).FindAllStringSubmatch(headersEnv, -1) {
headers[kv[1]] = kv[2]
}
} else {
if headersEnv := os.Getenv(envHeaders); headersEnv != "" {
for _, kv := range regexp.MustCompile(`(.*?)=([^=]*)(?:,|$)`).FindAllStringSubmatch(headersEnv, -1) {
headers[kv[1]] = kv[2]
if !config.Headers.IsNull() {
for k, v := range config.Headers.Elements() {
headers[k] = v.String()
}
}
}
Expand Down

0 comments on commit c57fb0f

Please sign in to comment.