lib/lamby/ssm_parameter_store.rb in lamby-2.1.0 vs lib/lamby/ssm_parameter_store.rb in lamby-2.2.0
- old
+ new
@@ -17,13 +17,14 @@
def get!(path)
parts = path.from(1).split('/')
env = parts.pop
path = "/#{parts.join('/')}"
- new(path).get!.params.detect do |p|
+ param = new(path).get!.params.detect do |p|
p.env == env
- end.try(:value)
+ end
+ param&.value
end
end
def initialize(path, options = {})
@@ -42,11 +43,11 @@
File.open(dotenv_file, 'w') { |f| f.write(dotenv_contents) }
end
def get!
get_all!
- get_history! if label.present?
+ get_history! unless label.to_s.empty?
self
end
def label
ENV['LAMBY_SSM_PARAMS_LABEL'] || @options[:label]
@@ -96,11 +97,11 @@
{ path: path,
recursive: true,
with_decryption: true,
max_results: MAX_RESULTS
}.tap { |options|
- token = @all_response.try(:next_token)
+ token = @all_response&.next_token
options[:next_token] = token if token
}
end
def parse_all
@@ -135,10 +136,10 @@
def get_history_options(name)
{ name: name,
with_decryption: true,
max_results: MAX_RESULTS
}.tap { |options|
- token = @hist_response.try(:next_token)
+ token = @hist_response&.next_token
options[:next_token] = token if token
}
end
def parse_history(name)