module Fluent::Plugin::MongoAuth
Public Instance Methods
authenticate(client)
click to toggle source
# File lib/fluent/plugin/mongo_auth.rb, line 17 def authenticate(client) unless @user.nil? || @password.nil? begin if @auth_source.nil? client = client.with(user: @user, password: @password) else client = client.with(user: @user, password: @password, auth_source: @auth_source) end rescue Mongo::Auth::Unauthorized => e log.fatal e exit! end end client end