Sha256: e50ebbfbcf2da1c4416404766f7e39ca828161c8f6f442c5fa711c0cb77df25e

Contents?: true

Size: 976 Bytes

Versions: 1

Compression:

Stored size: 976 Bytes

Contents

# dependencies
require "active_support"

# modules
require "kms_encrypted/log_subscriber"
require "kms_encrypted/model"
require "kms_encrypted/version"

module KmsEncrypted
  class << self
    attr_writer :aws_client
    attr_writer :google_client
    attr_writer :vault_client

    def aws_client
      @aws_client ||= Aws::KMS::Client.new(
        retry_limit: 2,
        http_open_timeout: 2,
        http_read_timeout: 2
      )
    end

    def google_client
      @google_client ||= begin
        require "google/apis/cloudkms_v1"
        client = ::Google::Apis::CloudkmsV1::CloudKMSService.new
        client.authorization = ::Google::Auth.get_application_default(
          "https://www.googleapis.com/auth/cloud-platform"
        )
        client
      end
    end

    def vault_client
      @vault_client ||= ::Vault
    end
  end
end

ActiveSupport.on_load(:active_record) do
  extend KmsEncrypted::Model
end

KmsEncrypted::LogSubscriber.attach_to :kms_encrypted

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kms_encrypted-0.3.0 lib/kms_encrypted.rb