Skip to content

Commit

Permalink
simplify the implementation of order of precedence for meta_server-ta…
Browse files Browse the repository at this point in the history
…g overrides/defaults
  • Loading branch information
Ithanil committed Jul 2, 2024
1 parent d0cc82f commit 9c622d0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/controllers/concerns/api_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,11 @@ def apply_config_server_tag(params)
override = Rails.configuration.x.override_create_params
default_tenant, override_tenant = TenantSetting.defaults_and_overrides(@tenant&.id)

params[:'meta_server-tag'] = default_tenant[:'meta_server-tag'] if params[:'meta_server-tag'].nil? && !default_tenant[:'meta_server-tag'].nil?
params[:'meta_server-tag'] = default[:'meta_server-tag'] if params[:'meta_server-tag'].nil? && !default[:'meta_server-tag'].nil?
params[:'meta_server-tag'] = override[:'meta_server-tag'] unless override[:'meta_server-tag'].nil?
params[:'meta_server-tag'] = override_tenant[:'meta_server-tag'] unless override_tenant[:'meta_server-tag'].nil?
params[:'meta_server-tag'] =
override_tenant[:'meta_server-tag'].presence ||
override[:'meta_server-tag'].presence ||
params[:'meta_server-tag'].presence ||
default_tenant[:'meta_server-tag'].presence ||
default[:'meta_server-tag'].presence
end
end

0 comments on commit 9c622d0

Please sign in to comment.