Skip to content

Commit

Permalink
ENV enablement key now takes precedence over local flag. No longer ra…
Browse files Browse the repository at this point in the history
…ising an exception on no auth key.
  • Loading branch information
aantix committed May 16, 2023
1 parent 0a948eb commit 34cc772
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .idea/checkpoint-rails.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion lib/callstacking/rails/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class Engine < ::Rails::Engine
@@loader.instrument_existing

loader.on_load
# loader.reset!
end

# Serialize all tracing requests for now.
Expand Down
6 changes: 2 additions & 4 deletions lib/callstacking/rails/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ def url
end

def auth_token
x = ENV['CALLSTACKING_API_TOKEN'] || settings[:auth_token]
raise "No auth token found. #{ENV['CALLSTACKING_API_TOKEN']} Please run `callstacking login` to get one." if x.nil?
x
ENV['CALLSTACKING_API_TOKEN'] || settings[:auth_token]
end

def auth_token?
Expand All @@ -52,8 +50,8 @@ def disable!
end

def enabled?
return Thread.current[CACHE_KEY] if Thread.current[CACHE_KEY].present?
return ActiveRecord::Type::Boolean.new.cast(ENV[ENV_KEY]) if ENV[ENV_KEY].present?
return Thread.current[CACHE_KEY] if Thread.current[CACHE_KEY].present?
false
end

Expand Down

0 comments on commit 34cc772

Please sign in to comment.