Skip to content

Commit

Permalink
[#98] Add support for YAML anchors
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny committed May 20, 2022
1 parent 8375d7c commit f3d0e26
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def valid_option_format?(option)

def config_options(compose_data)
compose_data.each_with_object([]) do |(key, value), keys|
if compose_data.equal?(value)
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.infinite_recursion', key: key)
end

keys << key
keys.concat(config_options(value)) if value.is_a?(Hash)
end
Expand Down
2 changes: 1 addition & 1 deletion core/app/services/uffizzi_core/compose_file_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def persist!(compose_file_form, cli_form)

def load_compose_data(compose_content)
begin
compose_data = YAML.safe_load(compose_content)
compose_data = YAML.safe_load(compose_content, aliases: true)
rescue Psych::SyntaxError
raise UffizziCore::ComposeFile::ParseError, 'Invalid compose file'
end
Expand Down
1 change: 1 addition & 0 deletions core/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ en:
invalid_healthcheck_command: "Service '%{name}' defines an invalid healthcheck: when 'test' is a list the first item must be either NONE, CMD or CMD-SHELL"
string_or_array_error: "'%{option}' contains an invalid type, it should be a string, or an array"
not_implemented: "'%{option}' option is not implemented"
infinite_recursion: "Found infinite recursion for key '%{key}'"
secrets:
duplicates_exists: Secret with key %{secrets} already exist.
invalid_key_length: A secret key must be no longer than 256 characters.

0 comments on commit f3d0e26

Please sign in to comment.