1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Don't log Redis AUTH requirepass.

This commit is contained in:
Jonathan Hyman 2013-11-17 10:20:28 -05:00
parent 5f6ef51251
commit 7bde88f398

View file

@ -1,5 +1,6 @@
require 'connection_pool' require 'connection_pool'
require 'redis' require 'redis'
require 'uri'
module Sidekiq module Sidekiq
class RedisConnection class RedisConnection
@ -53,10 +54,16 @@ module Sidekiq
end end
def log_info(options) def log_info(options)
# Don't log Redis AUTH password
scrubbed_options = options.dup
if scrubbed_options[:url] && (uri = URI.parse(scrubbed_options[:url])) && uri.password
uri.password = "REDACTED"
scrubbed_options[:url] = uri.to_s
end
if Sidekiq.server? if Sidekiq.server?
Sidekiq.logger.info("Booting Sidekiq #{Sidekiq::VERSION} with redis options #{options}") Sidekiq.logger.info("Booting Sidekiq #{Sidekiq::VERSION} with redis options #{scrubbed_options}")
else else
Sidekiq.logger.info("#{Sidekiq::NAME} client with redis options #{options}") Sidekiq.logger.info("#{Sidekiq::NAME} client with redis options #{scrubbed_options}")
end end
end end