mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
Use URL_HOST if provided
This commit is contained in:
@@ -133,14 +133,14 @@
|
||||
<div class="level-left">
|
||||
<code id="shareable-link">
|
||||
<%= if @device.config_token do %>
|
||||
<%= Routes.device_url(@socket, :config, @device.config_token) %>
|
||||
<%= shareable_link(@socket, @device) %>
|
||||
<% end %>
|
||||
</code>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<%= if @device.config_token do %>
|
||||
<button id="copy-shareable-link-button"
|
||||
data-clipboard={Routes.device_url(@socket, :config, @device.config_token)}
|
||||
data-clipboard={shareable_link(@socket, @device)}
|
||||
data-target="shareable-link"
|
||||
class="button"
|
||||
data-tooltip="Click to copy"
|
||||
|
||||
@@ -7,6 +7,7 @@ defmodule FzHttpWeb.LiveHelpers do
|
||||
import Phoenix.LiveView
|
||||
import Phoenix.LiveView.Helpers
|
||||
alias FzHttp.Users
|
||||
alias FzHttpWeb.Router.Helpers, as: Routes
|
||||
|
||||
import FzHttpWeb.ControllerHelpers, only: [root_path_for_role: 1]
|
||||
|
||||
@@ -63,6 +64,17 @@ defmodule FzHttpWeb.LiveHelpers do
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
URL_HOST is used in releases to set an externally-accessible url. Use that if exists.
|
||||
"""
|
||||
def shareable_link(socket, device) do
|
||||
if url_host = Application.get_env(:fz_http, :url_host) do
|
||||
"https://" <> url_host <> Routes.device_path(socket, :config, device.config_token)
|
||||
else
|
||||
Routes.device_url(socket, :config, device.config_token)
|
||||
end
|
||||
end
|
||||
|
||||
defp status_digit(response_code) when is_integer(response_code) do
|
||||
[status_digit | _tail] = Integer.digits(response_code)
|
||||
status_digit
|
||||
|
||||
@@ -92,6 +92,7 @@ config :fz_vpn,
|
||||
cli: FzVpn.CLI.Live
|
||||
|
||||
config :fz_http,
|
||||
url_host: url_host,
|
||||
connectivity_checks_enabled: connectivity_checks_enabled,
|
||||
connectivity_checks_interval: connectivity_checks_interval,
|
||||
admin_email: admin_email,
|
||||
|
||||
Reference in New Issue
Block a user