def decrypt(key, value, scope)
if encrypted? value
debug "Attempting to decrypt: #{key}"
Config[:eyaml].each do |config_key, config_value|
config_value = Backend.parse_string(Config[:eyaml][config_key], scope)
debug "Setting: #{config_key} = #{config_value}"
Eyaml::Options[config_key] = config_value
end
Eyaml::Options[:source] = "hiera"
parser = Eyaml::Parser::ParserFactory.hiera_backend_parser
tokens = parser.parse(value)
decrypted = tokens.map{ |token| token.to_plain_text }
plaintext = decrypted.join
plaintext.chomp
else
value
end
end