Created
February 26, 2010 16:53
-
-
Save thbar/315893 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# White-list based approach to only log what's relevant | |
# in Resque Hoptoad notifications. | |
# | |
# Disclaimer: this is provided as-is. Write your own tests. | |
# I can't be held responsible if this code still logs sensitive | |
# information into HopToad or contains bugs or whatever. | |
# | |
# This assume a single Hash arg for the Job. Example of use: | |
Resque::Failure::SensitiveHoptoad.configure do |config| | |
config.enabled_args = ['unsensitive-information'] | |
end | |
Resque.enqueue(self, { 'unsensitive-information' => filename, 'sensitive-info' => data }) | |
module Resque | |
module Failure | |
class SensitiveHoptoad < Hoptoad | |
class << self | |
attr_accessor :enabled_args | |
end | |
def payload | |
hash_arg = super['args'].first | |
args = self.class.enabled_args.inject({}) { |result,arg| result[arg] = hash_arg[arg]; result } | |
super.dup.merge('args' => [args]) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist is probably outdated due to the new hoptoad changes in Resque. I've removed it from the wiki — please feel free to re-add if I'm mistaken or once it's updated. Thanks!