Module: Fluent::Plugin::MongoAuth
- Included in:
- MongoStorage
- Defined in:
- lib/fluent/plugin/mongo_auth.rb
Instance Method Summary collapse
Instance Method Details
#authenticate(client) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# 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 |