module Fluent::MongoAuth
Public Instance Methods
authenticate(client)
click to toggle source
# File lib/fluent/plugin/mongo_auth.rb, line 18 def authenticate(client) begin if [@user, @password, @auth_source].all? client = client.with(user: @user, password: @password, auth_source: @auth_source) elsif [@user, @password].all? client = client.with(user: @user, password: @password) elsif [@user, @auth_source, @auth_mech].all? client = client.with(user: @user, auth_source: @auth_source, auth_mech: @auth_mech.to_sym) end rescue Mongo::Auth::Unauthorized => e log.fatal e exit! end client end