Sha256: 237d3518d09855ed1ca713170fc1f1c0a02cc0c5fe833fedc1b25184649af4c7

Contents?: true

Size: 722 Bytes

Versions: 4

Compression:

Stored size: 722 Bytes

Contents

# frozen_string_literal: true

require 'openssl'
require 'elasticsearch'
require 'ditty/services/logger'

module ProxES
  module Services
    module ES
      def client
        @client ||= Elasticsearch::Client.new(
          url: ENV['ELASTICSEARCH_URL'],
          transport_options: {
            ssl: {
              verify: ENV['SSL_VERIFY_NONE'].to_i != 1,
              cert_store: ssl_store
            }
          },
          logger: Ditty::Services::Logger.instance
        )
      end

      def ssl_store
        store = OpenSSL::X509::Store.new
        store.set_default_paths
        store
      end

      def conn
        client.transport.connections.get_connection.connection
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
proxes-0.9.13 lib/proxes/services/es.rb
proxes-0.9.12 lib/proxes/services/es.rb
proxes-0.9.9 lib/proxes/services/es.rb
proxes-0.9.7 lib/proxes/services/es.rb