Skip to content

Commit

Permalink
Ensure service and env are strings
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc committed Dec 12, 2023
1 parent c7ef57c commit 23a9645
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
7 changes: 2 additions & 5 deletions lib/datadog/core/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ def initialize(*_)
# @default `DD_ENV` environment variable, otherwise `nil`
# @return [String,nil]
option :env do |o|
# DEV-2.0: Remove this conversion for symbol.
o.setter { |v| v.to_s if v }

o.type :string, nilable: true
# NOTE: env also gets set as a side effect of tags. See the WORKAROUND note in #initialize for details.
o.env Core::Environment::Ext::ENV_ENVIRONMENT
end
Expand Down Expand Up @@ -404,8 +402,7 @@ def initialize(*_)
# @default `DD_SERVICE` environment variable, otherwise the program name (e.g. `'ruby'`, `'rails'`, `'pry'`)
# @return [String]
option :service do |o|
# DEV-2.0: Remove this conversion for symbol.
o.setter { |v| v.to_s if v }
o.type :string, nilable: true

# NOTE: service also gets set as a side effect of tags. See the WORKAROUND note in #initialize for details.
o.env Core::Environment::Ext::ENV_SERVICE
Expand Down
16 changes: 0 additions & 16 deletions spec/datadog/core/configuration/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,6 @@
it { expect(settings.env).to eq(env) }
end

context 'when given a symbol' do
let(:env) { :symbol }

before { set_env }

it { expect(settings.env).to eq('symbol') }
end

context 'when given `nil`' do
let(:env) { nil }

Expand Down Expand Up @@ -839,14 +831,6 @@
it { expect(settings.service).to eq(service) }
end

context 'when given a symbol' do
let(:service) { :symbol }

before { set_service }

it { expect(settings.service).to eq('symbol') }
end

context 'when given `nil`' do
let(:service) { nil }

Expand Down

0 comments on commit 23a9645

Please sign in to comment.