Sha256: c19da878f914197f3127ae7492d510c57af4746ab3815182484b4f30620b1824
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
# # A class for the secrets.json file # module LeapCli; module Config class Secrets < Object attr_reader :node_list def initialize(manager=nil) super(manager) @discovered_keys = {} end def set(key, value, environment=nil) environment ||= 'default' key = key.to_s @discovered_keys[environment] ||= {} @discovered_keys[environment][key] = true self[environment] ||= {} self[environment][key] ||= value end # # if only_discovered_keys is true, then we will only export # those secrets that have been discovered and the prior ones will be cleaned out. # # this should only be triggered when all nodes have been processed, otherwise # secrets that are actually in use will get mistakenly removed. # def dump_json(only_discovered_keys=false) if only_discovered_keys self.each_key do |environment| self[environment].each_key do |key| unless @discovered_keys[environment] && @discovered_keys[environment][key] self[environment].delete(key) end end if self[environment].empty? self.delete(environment) end end end super() end end end; end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
leap_cli-1.5.1 | lib/leap_cli/config/secrets.rb |
leap_cli-1.5.0 | lib/leap_cli/config/secrets.rb |