lib/foreplay/engine/secrets/location.rb in foreplay-0.13.3 vs lib/foreplay/engine/secrets/location.rb in foreplay-0.13.4
- old
+ new
@@ -24,22 +24,29 @@
@secrets = {}
else
log 'No secrets found'
url ? log("Looked in #{url}") : log('No url found')
log("Secrets #{all_secrets.key?(environment) ? 'has a' : 'has no'} key #{environment}") if all_secrets
- log all_secrets.inspect if all_secrets
@secrets = {}
end
end
def all_secrets
return @all_secrets if @all_secrets
- @all_secrets = url ? YAML.load(`#{command}`) : {}
+ @all_secrets = url ? YAML.load(raw_secrets) : {}
rescue Psych::SyntaxError => e
log "Exception caught when loading secrets from this location: #{url}"
log "#{e.class}: #{e.message}".red
@all_secrets = {}
+ end
+
+ def raw_secrets
+ return @raw_secrets if @raw_secrets
+ @raw_secrets = `#{command}`
+ log command
+ log @raw_secrets
+ @raw_secrets
end
def command
@command ||= "curl -k -L#{header_string} #{url}".fake_erb
end