|
18 | 18 | require 'elasticsearch/version'
|
19 | 19 | require 'elastic/transport'
|
20 | 20 | require 'elasticsearch/api'
|
21 |
| -require 'base64' |
22 | 21 |
|
23 | 22 | module Elasticsearch
|
24 | 23 | NOT_ELASTICSEARCH_WARNING = 'The client noticed that the server is not Elasticsearch and we do not support this unknown product.'.freeze
|
@@ -108,7 +107,8 @@ def verify_elasticsearch(*args, &block)
|
108 | 107 |
|
109 | 108 | def setup_cloud_host(cloud_id, user, password, port)
|
110 | 109 | name = cloud_id.split(':')[0]
|
111 |
| - cloud_url, elasticsearch_instance = Base64.decode64(cloud_id.gsub("#{name}:", '')).split('$') |
| 110 | + base64_decoded = cloud_id.gsub("#{name}:", '').unpack1('m') |
| 111 | + cloud_url, elasticsearch_instance = base64_decoded.split('$') |
112 | 112 |
|
113 | 113 | if cloud_url.include?(':')
|
114 | 114 | url, port = cloud_url.split(':')
|
@@ -150,7 +150,8 @@ def setup_cloud(arguments)
|
150 | 150 | # Credentials is the base64 encoding of id and api_key joined by a colon
|
151 | 151 | # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html
|
152 | 152 | def encode(api_key)
|
153 |
| - Base64.strict_encode64([api_key[:id], api_key[:api_key]].join(':')) |
| 153 | + credentials = [api_key[:id], api_key[:api_key]].join(':') |
| 154 | + [credentials].pack('m0') |
154 | 155 | end
|
155 | 156 |
|
156 | 157 | def elasticsearch_validation_request
|
|
0 commit comments