hotfix: reload dns config before sending it

This commit is contained in:
Andrew Dryga
2024-03-27 18:48:27 -06:00
parent 7e73039710
commit fab95483e8
2 changed files with 17 additions and 3 deletions

View File

@@ -88,12 +88,14 @@ defmodule API.Client.Channel do
end
def handle_info(:config_changed, socket) do
account = Accounts.fetch_account_by_id!(socket.assigns.client.account_id)
:ok =
push(socket, "config_changed", %{
interface:
Views.Interface.render(%{
socket.assigns.client
| account: socket.assigns.subject.account
| account: account
})
})

View File

@@ -242,10 +242,22 @@ defmodule API.Client.ChannelTest do
describe "handle_info/2 :config_changed" do
test "sends updated configuration", %{
account: account,
client: client,
socket: socket
} do
channel_pid = socket.channel_pid
Fixtures.Accounts.update_account(
account,
config: %{
clients_upstream_dns: [
%{protocol: "ip_port", address: "1.2.3.1"},
%{protocol: "ip_port", address: "1.8.8.1:53"}
]
}
)
send(channel_pid, :config_changed)
assert_push "config_changed", %{interface: interface}
@@ -254,8 +266,8 @@ defmodule API.Client.ChannelTest do
ipv4: client.ipv4,
ipv6: client.ipv6,
upstream_dns: [
%{protocol: :ip_port, address: "1.1.1.1:53"},
%{protocol: :ip_port, address: "8.8.8.8:53"}
%{protocol: :ip_port, address: "1.2.3.1:53"},
%{protocol: :ip_port, address: "1.8.8.1:53"}
]
}
end