Method: ElasticAPM::Config#ssl_context

Defined in:
lib/elastic_apm/config.rb

#ssl_contextObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/elastic_apm/config.rb', line 223

def ssl_context
  return unless use_ssl?

  @ssl_context ||=
    OpenSSL::SSL::SSLContext.new.tap do |context|
      if server_ca_cert_file
        context.ca_file = server_ca_cert_file
      else
        context.cert_store =
          OpenSSL::X509::Store.new.tap(&:set_default_paths)
      end

      context.verify_mode =
        if verify_server_cert
          OpenSSL::SSL::VERIFY_PEER
        else
          OpenSSL::SSL::VERIFY_NONE
        end
    end
end