Skip to content

Commit a2e5b3d

Browse files
committed
Add array-matchable support for reverse_host
The hostname follows the format of a regular DNS name, the reverse is the reverse of that (split at the points). This makes it easier to dispatch on certain subdomains.
1 parent d346090 commit a2e5b3d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matcher.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ defmodule Matcher do
324324
layers = layers_fn.()
325325
|> Log.inspect(:log_available_layers, "Available layers")
326326

327+
reverse_host = Enum.reverse( host )
328+
327329
response_conn =
328330
layers
329331
|> Enum.find_value(fn layer ->
@@ -335,7 +337,7 @@ defmodule Matcher do
335337
accept_hashes
336338
|> Enum.find_value(fn accept ->
337339
options =
338-
%{accept: accept, host: host, layer: layer}
340+
%{accept: accept, host: host, reverse_host: reverse_host, layer: layer}
339341
# Also use old format of layer_name: true
340342
|> Map.put(layer, true)
341343

0 commit comments

Comments
 (0)