Skip to content

Commit

Permalink
Update core configuration to use env and type options
Browse files Browse the repository at this point in the history
  • Loading branch information
GustavoCaso committed Jul 24, 2023
1 parent c0fc32e commit b35cef9
Show file tree
Hide file tree
Showing 60 changed files with 789 additions and 361 deletions.
11 changes: 6 additions & 5 deletions lib/datadog/ci/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def self.add_settings!(base)
base.class_eval do
settings :ci do
option :enabled do |o|
o.default { env_to_bool(CI::Ext::Settings::ENV_MODE_ENABLED, false) }
o.type :bool
o.env CI::Ext::Settings::ENV_MODE_ENABLED
o.default false
end

# DEV: Alias to Datadog::Tracing::Contrib::Extensions::Configuration::Settings#instrument.
Expand All @@ -34,12 +36,11 @@ def self.add_settings!(base)
# TODO: Deprecate in the next major version, as `instrument` better describes this method's purpose
alias_method :use, :instrument

option :trace_flush do |o|
o.default { nil }
end
option :trace_flush

option :writer_options do |o|
o.default { {} }
o.type :hash
o.default({})
end
end
end
Expand Down
9 changes: 7 additions & 2 deletions lib/datadog/ci/contrib/cucumber/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ module Configuration
# TODO: mark as `@public_api` when GA
class Settings < Datadog::Tracing::Contrib::Configuration::Settings
option :enabled do |o|
o.default { env_to_bool(Ext::ENV_ENABLED, true) }
o.type :bool
o.env Ext::ENV_ENABLED
o.default true
end

option :service_name do |o|
o.type :string
o.default { Datadog.configuration.service_without_fallback || Ext::SERVICE_NAME }
end

option :operation_name do |o|
o.default { ENV.fetch(Ext::ENV_OPERATION_NAME, Ext::OPERATION_NAME) }
o.type :string
o.env Ext::ENV_OPERATION_NAME
o.default Ext::OPERATION_NAME
end
end
end
Expand Down
9 changes: 7 additions & 2 deletions lib/datadog/ci/contrib/minitest/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ module Configuration
# TODO: mark as `@public_api` when GA
class Settings < Datadog::Tracing::Contrib::Configuration::Settings
option :enabled do |o|
o.default { env_to_bool(Ext::ENV_ENABLED, true) }
o.type :bool
o.env Ext::ENV_ENABLED
o.default true
end

option :service_name do |o|
o.type :string
o.default { Datadog.configuration.service_without_fallback || Ext::SERVICE_NAME }
end

option :operation_name do |o|
o.default { ENV.key?(Ext::ENV_OPERATION_NAME) ? ENV[Ext::ENV_OPERATION_NAME] : Ext::OPERATION_NAME }
o.type :string
o.env Ext::ENV_OPERATION_NAME
o.default Ext::OPERATION_NAME
end
end
end
Expand Down
9 changes: 7 additions & 2 deletions lib/datadog/ci/contrib/rspec/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ module Configuration
# TODO: mark as `@public_api` when GA
class Settings < Datadog::Tracing::Contrib::Configuration::Settings
option :enabled do |o|
o.default { env_to_bool(Ext::ENV_ENABLED, true) }
o.type :bool
o.env Ext::ENV_ENABLED
o.default true
end

option :service_name do |o|
o.type :string
o.default { Datadog.configuration.service_without_fallback || Ext::SERVICE_NAME }
end

option :operation_name do |o|
o.default { ENV.fetch(Ext::ENV_OPERATION_NAME, Ext::OPERATION_NAME) }
o.type :string
o.env Ext::ENV_OPERATION_NAME
o.default Ext::OPERATION_NAME
end
end
end
Expand Down
Loading

0 comments on commit b35cef9

Please sign in to comment.