Sha256: eada14b3cf17e32e9886aa62ab1bbc8aef5851f25f0e4567b079fb8065da9380

Contents?: true

Size: 460 Bytes

Versions: 6

Compression:

Stored size: 460 Bytes

Contents

module Fluent


module MongoUtil
  def self.included(klass)
    klass.instance_eval {
      config_param :user, :string, :default => nil
      config_param :password, :string, :default => nil, :secret => true
    }
  end

  def authenticate(db)
    unless @user.nil? || @password.nil?
      begin
        db.authenticate(@user, @password)
      rescue Mongo::AuthenticationError => e
        log.fatal e
        exit!
      end
    end

    db
  end
end


end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fluent-plugin-mongo-0.7.16 lib/fluent/plugin/mongo_util.rb
fluent-plugin-mongo-0.7.15 lib/fluent/plugin/mongo_util.rb
fluent-plugin-mongo-0.7.14 lib/fluent/plugin/mongo_util.rb
fluent-plugin-mongo-0.7.13 lib/fluent/plugin/mongo_util.rb
fluent-plugin-mongo-0.7.12 lib/fluent/plugin/mongo_util.rb
fluent-plugin-mongo-0.7.11 lib/fluent/plugin/mongo_util.rb