lib/fluent/plugin/out_redis.rb in fluent-plugin-redis-0.2.1 vs lib/fluent/plugin/out_redis.rb in fluent-plugin-redis-0.2.2
- old
+ new
@@ -4,10 +4,11 @@
attr_reader :redis
config_param :host, :string, :default => 'localhost'
config_param :port, :integer, :default => 6379
config_param :db_number, :integer, :default => 0
+ config_param :password, :string, :default => nil, :secret => true
# To support log_level option implemented by Fluentd v0.10.43
unless method_defined?(:log)
define_method("log") { $log }
end
@@ -27,11 +28,18 @@
end
def start
super
- @redis = Redis.new(:host => @host, :port => @port,
- :thread_safe => true, :db => @db_number)
+ options = {
+ :host => @host,
+ :port => @port,
+ :thread_safe => true,
+ :db => @db_number
+ }
+ options[:password] = @password if @password
+
+ @redis = Redis.new(options)
end
def shutdown
@redis.quit
super