From 263b4a4fb8ecf10834fc12ccdddf2c267270eabe Mon Sep 17 00:00:00 2001 From: Matthew Kent Date: Sat, 11 Nov 2023 13:03:23 -0800 Subject: [PATCH] Enable aliases for more exotic templating situations. This is super useful for DRY when configuring a number of roles and you hit the limits of what's reasonable with ERB. --- lib/kamal/configuration.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/kamal/configuration.rb b/lib/kamal/configuration.rb index fc881c06..87c68dc5 100644 --- a/lib/kamal/configuration.rb +++ b/lib/kamal/configuration.rb @@ -25,7 +25,9 @@ class Kamal::Configuration def load_config_file(file) if file.exist? - YAML.load(ERB.new(IO.read(file)).result).symbolize_keys + # Newer Psych doesn't load aliases by default + load_method = YAML.respond_to?(:unsafe_load) ? :unsafe_load : :load + YAML.send(load_method, ERB.new(IO.read(file)).result).symbolize_keys else raise "Configuration file not found in #{file}" end