Skip to content

Commit

Permalink
Enable aliases for more exotic templating situations.
Browse files Browse the repository at this point in the history
This is super useful for DRY when configuring a number of roles and you
hit the limits of what's reasonable with ERB.
  • Loading branch information
mdkent committed Nov 12, 2023
1 parent 97ba6b7 commit 263b4a4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/kamal/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def load_config_files(*files)

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
Expand Down

0 comments on commit 263b4a4

Please sign in to comment.