Sha256: 22c42ec77e96a95807a4ccb2b7ee92a2704966453833f6e4433585ea1af0f27e

Contents?: true

Size: 784 Bytes

Versions: 1

Compression:

Stored size: 784 Bytes

Contents

require 'aws-sdk-ssm'
require 'forwardable'

require 'param_store/version'
require 'param_store/wrapper'
require 'param_store/adapters/env'
require 'param_store/adapters/ssm'

module ParamStore
  extend SingleForwardable

  def_delegators(
    :'@wrapper',
    :fetch,
    :copy_to_env,
    :require_keys!
  )

  class << self
    attr_accessor :path
    attr_reader :adapter, :wrapper

    def ssm_client
      @_ssm_client ||= Aws::SSM::Client.new
    end

    def adapter=(adapter)
      @adapter = adapter
      @wrapper = Wrapper.new(adapter_class(adapter))
    end

    def adapter_class(adapter)
      case adapter
      when :env
        Adapters::Env
      when :aws_ssm
        Adapters::SSM
      else
        raise "Invalid adapter: #{adapter}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
param_store-0.0.1 lib/param_store.rb