psenv/lib/psenv.rb

24 lines
571 B
Ruby
Raw Normal View History

2018-03-28 21:51:39 -04:00
require "psenv/environment"
require "psenv/retriever"
2018-03-22 18:01:53 -04:00
require "psenv/version"
require "aws-sdk-ssm"
module Psenv
module_function
2018-03-28 21:51:39 -04:00
def load(*paths)
paths.unshift(ENV["PARAMETER_STORE_PATH"]) if ENV["PARAMETER_STORE_PATH"]
Environment.create(*paths.map { |path| retrieve_variables(path) }).apply
end
def overload(*paths)
paths.unshift(ENV["PARAMETER_STORE_PATH"]) if ENV["PARAMETER_STORE_PATH"]
Environment.create(*paths.map { |path| retrieve_variables(path) }).apply!
end
2018-03-22 18:01:53 -04:00
2018-03-28 21:51:39 -04:00
def retrieve_variables(path)
Retriever.new(path).call
2018-03-22 18:01:53 -04:00
end
end