Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

Commit

Permalink
internal/config: use Getenv as opposed to Lookupenv (#547)
Browse files Browse the repository at this point in the history
This is so that when an environment variable is empty, it will be
ignored when being considered for overriding actual config values.
  • Loading branch information
gbbr authored Dec 6, 2018
1 parent 2c4a8a7 commit 148ffc2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/config/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ func applyEnv() {
"HTTPS_PROXY": "proxy.https",
"DD_PROXY_HTTPS": "proxy.https",
} {
if v, ok := os.LookupEnv(envKey); ok {
if v := os.Getenv(envKey); v != "" {
config.Datadog.Set(cfgKey, v)
}
}
if v, ok := os.LookupEnv("DD_IGNORE_RESOURCE"); ok {
if v := os.Getenv("DD_IGNORE_RESOURCE"); v != "" {
if r, err := splitString(v, ','); err != nil {
log.Warn("%q value not loaded: %v", "DD_IGNORE_RESOURCE", err)
} else {
config.Datadog.Set("apm_config.ignore_resources", r)
}
}
if v, ok := os.LookupEnv("DD_APM_ANALYZED_SPANS"); ok {
if v := os.Getenv("DD_APM_ANALYZED_SPANS"); v != "" {
analyzedSpans, err := parseAnalyzedSpans(v)
if err == nil {
config.Datadog.Set("apm_config.analyzed_spans", analyzedSpans)
Expand Down

0 comments on commit 148ffc2

Please sign in to comment.