Sha256: 0afc6ef23709e0c179d26f1dca3b2dd85b729df2299779cd1a0adbc0dbd0accd

Contents?: true

Size: 679 Bytes

Versions: 7

Compression:

Stored size: 679 Bytes

Contents

module ConfigHelper
  def ConfigHelper.get_as_api_key
    ENV.fetch('AS_API_KEY', 'API_KEY')
  end

  def ConfigHelper.get_as_admin_key
    ENV.fetch('AS_ADMIN_KEY', 'ADMIN_KEY')
  end

  def ConfigHelper.get_as_host_identifier
    ENV['AS_ACCOUNT_HOST_KEY'] || ENV['AS_HOST_IDENTIFIER'] || 'ACCOUNT_HOST_KEY'
  end

  def ConfigHelper.get_as_api_endpoint
    ENV.fetch('AS_API_ENDPOINT', nil)
  end

  def ConfigHelper.get_client_options(as_api_key, as_host_identifier, as_api_endpoint)
    {
      :api_key => as_api_key,
      :host_identifier => as_host_identifier
    }.tap do |opts|
      opts[:api_endpoint] = as_api_endpoint unless as_api_endpoint.nil?
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
elastic-app-search-7.10.0 spec/config_helper.rb
elastic-app-search-7.9.0 spec/config_helper.rb
elastic-app-search-7.8.0 spec/config_helper.rb
elastic-app-search-7.7.0 spec/config_helper.rb
elastic-app-search-7.6.0 spec/config_helper.rb
elastic-app-search-7.5.0 spec/config_helper.rb
elastic-app-search-7.4.1 spec/config_helper.rb