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.
This commit is contained in:
Matthew Kent
2023-11-11 13:03:23 -08:00
parent 97ba6b746b
commit 263b4a4fb8

View File

@@ -25,7 +25,9 @@ class Kamal::Configuration
def load_config_file(file) def load_config_file(file)
if file.exist? 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 else
raise "Configuration file not found in #{file}" raise "Configuration file not found in #{file}"
end end