Skip to content

Commit

Permalink
More flexible env vars
Browse files Browse the repository at this point in the history
This makes "true", "false", "1", "0" all work.
jnunemaker committed Nov 19, 2023
1 parent 4f4da36 commit 27b1fc1
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions lib/flipper/cloud/configuration.rb
Original file line number Diff line number Diff line change
@@ -124,10 +124,10 @@ def initialize(options = {})

# Telemetry setup.
@telemetry_logger = options.fetch(:telemetry_logger) {
if ENV["FLIPPER_CLOUD_TELEMETRY_LOGGER"] == "0"
Logger.new("/dev/null")
else
if Flipper::Typecast.to_boolean(ENV["FLIPPER_CLOUD_TELEMETRY_LOGGING"])
Logger.new(STDOUT)
else
Logger.new("/dev/null")
end
}
@telemetry_interval = options.fetch(:telemetry_interval) {
@@ -142,14 +142,14 @@ def initialize(options = {})
enforce_minimum(:telemetry_shutdown_timeout, 0)

# This is alpha. Don't use this unless you are me. And you are not me.
provided_instrumenter = options.fetch(:instrumenter, Instrumenters::Noop)
instrumenter = options.fetch(:instrumenter, Instrumenters::Noop)
cloud_instrument = options.fetch(:cloud_instrument) {
ENV["FLIPPER_CLOUD_INSTRUMENT"] == "1"
Flipper::Typecast.to_boolean(ENV["FLIPPER_CLOUD_INSTRUMENT"])
}
@instrumenter = if cloud_instrument
Telemetry::Instrumenter.new(self, provided_instrumenter)
Telemetry::Instrumenter.new(self, instrumenter)
else
provided_instrumenter
instrumenter
end
end

2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
Dir[FlipperRoot.join('spec/support/**/*.rb')].sort.each { |f| require f }

# Disable telemetry logging in specs.
ENV["FLIPPER_CLOUD_TELEMETRY_LOGGER"] = "0"
ENV["FLIPPER_CLOUD_TELEMETRY_LOGGING"] = "0"

RSpec.configure do |config|
config.before(:example) do

0 comments on commit 27b1fc1

Please sign in to comment.