diff --git a/lib/uplink/clients/caddy/config/builder.ex b/lib/uplink/clients/caddy/config/builder.ex index 8e366f4..e9433a1 100644 --- a/lib/uplink/clients/caddy/config/builder.ex +++ b/lib/uplink/clients/caddy/config/builder.ex @@ -83,7 +83,8 @@ defmodule Uplink.Clients.Caddy.Config.Builder do %{wrapper: "tls"} ], routes: - Enum.flat_map(installs, &build_route/1) + installs + |> Enum.flat_map(&build_route/1) |> Enum.uniq_by(fn route -> path = Enum.map(route.match, fn m -> m.path end) @@ -96,6 +97,11 @@ defmodule Uplink.Clients.Caddy.Config.Builder do |> Enum.join(":") "#{route.group}_#{host}_#{path}" + end) + |> Enum.sort_by(fn route -> + paths = Enum.flat_map(route.match, fn m -> m.path end) + + if Enum.any?(paths, &(&1 == "*")), do: 1, else: 0 end), logs: %{ default_logger_name: "default" @@ -268,11 +274,6 @@ defmodule Uplink.Clients.Caddy.Config.Builder do sub_routes_and_proxies = Enum.concat(sub_routes, proxy_routes) [main_route | sub_routes_and_proxies] - |> Enum.sort_by(fn route -> - paths = Enum.flat_map(route.match, fn m -> m.path end) - - if Enum.any?(paths, &(&1 == "*")), do: 1, else: 0 - end) end defp find_valid_instances(instances, install_id) do diff --git a/mix.exs b/mix.exs index 0b953be..44ee2b0 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Uplink.MixProject do def project do [ app: :uplink, - version: "0.12.4", + version: "0.12.5", elixir: "~> 1.13", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod,