Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an env vars to configure traxor on the fly #12

Merged
merged 3 commits into from
Aug 21, 2018
Merged

Conversation

ketiko
Copy link
Owner

@ketiko ketiko commented Aug 21, 2018

No description provided.

@ketiko ketiko changed the title Adding an env var to disable traxor on the fly Adding an env vars to configure traxor on the fly Aug 21, 2018
@ketiko ketiko merged commit d985184 into master Aug 21, 2018
@ketiko ketiko deleted the ryan/disable branch August 21, 2018 15:20
@@ -21,4 +17,25 @@ def self.initialize_logger(log_target = STDOUT)
end
@logger
end

def self.enabled?
@enabled ||= ENV.fetch('TRAXOR_ENABLED', true).present?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will return false as expected. For example, if an env var TRAXOR_ENABLED=false is set, then ENV.fetch('TRAXOR_ENABLED', true) will return the string 'false' (not a boolean), and then 'false'.present? returns true.
I think we want to ask for a positive on the env var. So if Traxor is disabled by default we would want

@enabled ||= !ENV['TRAXOR_ENABLED'].nil?

Or if Traxor is enabled by default we would want

@enabled ||= ENV['TRAXOR_DISABLED'].nil?

Let me know if I'm missing something here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants