Sha256: 949c4c40755c5dfb67252737b8c3d13c6de7e70a94658470f5187cf4175d5d5c

Contents?: true

Size: 640 Bytes

Versions: 11

Compression:

Stored size: 640 Bytes

Contents

require_relative '../../models/team/mongoid.rb'

require 'kaminari/grape'
require 'mongoid-scroll'

module SlackRubyBotServer
  module DatabaseAdapter
    def self.check!
      rc = Mongoid.default_client.command(ping: 1)
      return if rc&.ok?

      raise rc.documents.first['error'] || 'Unexpected error.'
    rescue StandardError => e
      warn "Error connecting to MongoDB: #{e.message}"
      raise e
    end

    def self.init!
      # create indexes
      ::Mongoid::Tasks::Database.create_indexes
      # silence loggers
      Mongoid.logger.level = Logger::INFO
      Mongo::Logger.logger.level = Logger::INFO
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
slack-ruby-bot-server-2.1.1 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-2.1.0 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-2.0.1 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-1.2.1 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-1.2.0 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-1.1.0 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-1.0.0 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.12.3 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.12.2 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.12.1 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
slack-ruby-bot-server-0.12.0 lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb