Skip to content

Commit

Permalink
[Bugfix][Oracle] path order in routing_policy working for null/empty …
Browse files Browse the repository at this point in the history
…values
  • Loading branch information
Martouta committed Sep 10, 2019
1 parent 76b5ed5 commit 411b370
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/lib/backend_api_logic/routing_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def initialize(service)
end

def to_a
rules = backend_api_configs.reorder(path: :desc).each_with_object([]) do |config, rules|
rules = backend_api_configs.reordering { sift(:path_desc) }.each_with_object([]) do |config, rules|
rule = Rule.new(config).as_json
rules << rule if rule
end
Expand Down Expand Up @@ -54,7 +54,7 @@ def as_json
end

def path_to_regex
if path.empty?
if path.to_s.empty?
"/.*"
else
"/#{path}/.*|/#{path}/?"
Expand Down
4 changes: 4 additions & 0 deletions app/models/backend_api_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class BackendApiConfig < ApplicationRecord
backend_api.metrics.each { |metric| metric.send(:sync_backend) }
end

sifter :path_desc do
System::Database.oracle? ? 'path DESC NULLS LAST' : {path: :desc}
end

delegate :private_endpoint, to: :backend_api

def path=(value)
Expand Down

0 comments on commit 411b370

Please sign in to comment.