Sha256: 07b0ee78e2214ddd029ddaf3d5ca727c6618881aed3cfc06ab66c995503852e4
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require "aws-sdk-ssm" module Chambermaid class ParameterStore def initialize(path:) @path = path end def load! fetch_ssm_params! end def self.load!(path:) store = new(path: path) store.load! store end def params @params ||= @param_list.map { |p| [p.name.split("/").last.upcase, p.value] }.to_h end alias :to_h :params def to_env params.inject("") do |env_str, param| env_str + "#{param[0]}=#{param[1]}\n" end end private def client @client ||= Aws::SSM::Client.new end def fetch_ssm_params! @param_list = [] response = nil loop do response = fetch_ssm_param_batch!(response&.next_token) @param_list.concat(response.parameters) break unless response.next_token end end def fetch_ssm_param_batch!(next_token = nil) client.get_parameters_by_path( path: @path, with_decryption: true, recursive: true, next_token: next_token ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chambermaid-0.1.0 | lib/chambermaid/parameter_store.rb |