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"]
|
2018-04-09 18:08:14 -04:00
|
|
|
Environment.new(*paths.map { |path| retrieve_variables(path) }).apply
|
2018-03-28 21:51:39 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def overload(*paths)
|
|
|
|
paths.unshift(ENV["PARAMETER_STORE_PATH"]) if ENV["PARAMETER_STORE_PATH"]
|
2018-04-09 18:08:14 -04:00
|
|
|
Environment.new(*paths.map { |path| retrieve_variables(path) }).apply!
|
2018-03-28 21:51:39 -04:00
|
|
|
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
|