Sha256: d280f0b9a0e854aa09d3e4ab0c60f7826799966c4199ed33ffbfd40f8686cda4
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
require "chambermaid/parameter_store" module Chambermaid module Base extend self def configure yield self end # @todo def configuration raise "Namespaces must be defined" unless @namespaces end # @todo def reload! end # Add an AWS SSM parameter namespace to ENV # # @param [String] path # @param [Boolean] overwrite_duplicates # true - replace any duplicate ENV keys with new params # false - keep any existing duplicate ENV key values # # @raise def add_namespace(path, overwrite_duplicates: false) @namespaces ||= {} raise "namespace already included in ENV" unless @namespaces[path].nil? @namespaces[path] = ParameterStore.load!(path: path) update_env!( params: @namespaces[path].params, overwrite_duplicates: overwrite_duplicates ) end # Inject into ENV # # @param [Hash] params # @param [Boolean] overwrite_duplicates # true - replace any duplicate ENV keys with new params # false - keep any existing duplicate ENV key values def update_env!(params:, overwrite_duplicates:) if overwrite_duplicates ENV.update(params) else current_env = ENV.to_h.dup new_env = params.merge(current_env) ENV.replace(new_env) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chambermaid-0.1.0 | lib/chambermaid/base.rb |