Skip to content

Commit

Permalink
Prioritize service name passed through the env over the Options confi…
Browse files Browse the repository at this point in the history
…guration
  • Loading branch information
Andrey Slotin committed Feb 5, 2020
1 parent cdd7011 commit 40ab144
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ func (r *sensorS) setOptions(options *Options) {
}

func (r *sensorS) configureServiceName() {
if r.options != nil {
r.serviceName = r.options.Service
if name, ok := os.LookupEnv("INSTANA_SERVICE_NAME"); ok {
r.serviceName = name
return
}

if r.serviceName == "" {
r.serviceName = os.Getenv("INSTANA_SERVICE_NAME")
if r.options != nil {
r.serviceName = r.options.Service
}

if r.serviceName == "" {
Expand Down

0 comments on commit 40ab144

Please sign in to comment.