chore(portal): Bump elixir to 1.18.2 (#8009)

This is mostly to stay up to date with current Elixir and benefit from
the new included [JSON parser](https://hexdocs.pm/elixir/JSON.html).

Removing `Jason` in favor of the embedded `JSON` parser is saved for a
[future PR](https://github.com/firezone/firezone/issues/8011).

It found a couple type violations which were simple to fix, and some
formatting changes.
This commit is contained in:
Jamil
2025-02-05 15:52:58 -08:00
committed by GitHub
parent 006ea4c6fd
commit a93f40befd
10 changed files with 37 additions and 33 deletions

View File

@@ -1,7 +1,7 @@
# These are used for the dev environment.
# This should match the versions used in the built product.
nodejs 20.14.0
elixir 1.17.2-otp-27
elixir 1.18.2-otp-27
erlang 27.2.1
terraform 1.10.4

View File

@@ -1,8 +1,8 @@
ARG ALPINE_VERSION="3.20.5"
ARG ERLANG_VERSION="27.2.1"
ARG ERLANG_DOWNLOAD_SHA256="07982134e10637dde57cf9cdc6dda6f65425810229986136d184766d4db9eda3"
ARG ELIXIR_VERSION="1.17.2"
ARG ELIXIR_DOWNLOAD_SHA256="7bb8e6414b77c1707f39f620a2ad54f68d64846d663ec78069536854247fb1ab"
ARG ELIXIR_VERSION="1.18.2"
ARG ELIXIR_DOWNLOAD_SHA256="efc8d0660b56dd3f0c7536725a95f4d8b6be9f11ca9779d824ad79377753e916"
FROM alpine:${ALPINE_VERSION} AS base

View File

@@ -3,7 +3,9 @@ defmodule Domain.Accounts.Config do
@primary_key false
embedded_schema do
embeds_many :clients_upstream_dns, ClientsUpstreamDNS, primary_key: false, on_replace: :delete do
embeds_many :clients_upstream_dns, ClientsUpstreamDNS,
primary_key: false,
on_replace: :delete do
field :protocol, Ecto.Enum, values: [:ip_port, :dns_over_tls, :dns_over_http]
field :address, :string
end

View File

@@ -19,20 +19,19 @@ defmodule Domain.Config.Resolver do
end
end
@dialyzer {:nowarn_function, fetch_process_env: 1, resolve_process_env_value: 1}
defp resolve_process_env_value(key) do
pdict_key = {__MODULE__, key}
case fetch_process_env(pdict_key) do
{:ok, {:env, value}} ->
{:ok, {{:env, env_key(key)}, value}}
:error ->
:error
end
end
if Mix.env() == :test do
defp resolve_process_env_value(key) do
pdict_key = {__MODULE__, key}
case fetch_process_env(pdict_key) do
{:ok, {:env, value}} ->
{:ok, {{:env, key}, value}}
:error ->
:error
end
end
def fetch_process_env(pdict_key) do
with :error <- fetch_process_value(pdict_key),
:error <- fetch_process_value(Process.get(:last_caller_pid), pdict_key),
@@ -74,7 +73,7 @@ defmodule Domain.Config.Resolver do
end
end
else
def fetch_process_env(_pdict_key), do: :error
defp resolve_process_env_value(_key), do: :error
end
defp resolve_env_value(env_configurations, key, opts) do

View File

@@ -58,7 +58,7 @@ defmodule Domain.Types.CIDR do
end
defp reset_right_bits(number, shift) do
number >>> shift <<< shift
(number >>> shift) <<< shift
end
defp fill_right_bits(number, shift) do

View File

@@ -490,7 +490,10 @@ defmodule Domain.Policies.Condition.EvaluatorTest do
assert parse_days_of_week_time_ranges(["M/true/UTC"]) ==
{:ok, %{"M" => [{~T[00:00:00], ~T[23:59:59], "UTC"}]}}
assert parse_days_of_week_time_ranges(["M/true/UTC", "W/19:00:00-22:00:00,22-23/US/Pacific"]) ==
assert parse_days_of_week_time_ranges([
"M/true/UTC",
"W/19:00:00-22:00:00,22-23/US/Pacific"
]) ==
{:ok,
%{
"M" => [

View File

@@ -143,7 +143,7 @@ defmodule Web.Groups.EditActors do
<div class="flex justify-end">
<.button_with_confirmation
id="save_changes"
style={(@added == %{} and @removed == %{} && "disabled") || "primary"}
style={((@added == %{} and @removed == %{}) && "disabled") || "primary"}
confirm_style="primary"
class="m-4"
on_confirm="submit"

View File

@@ -112,8 +112,8 @@ defmodule Web.Settings.Billing do
</:label>
<:value>
<span class={[
not is_nil(@users_count) and
@users_count > @account.limits.users_count && "text-red-500"
(not is_nil(@users_count) and
@users_count > @account.limits.users_count) && "text-red-500"
]}>
{@users_count} used
</span>
@@ -127,8 +127,8 @@ defmodule Web.Settings.Billing do
</:label>
<:value>
<span class={[
not is_nil(@active_users_count) and
@active_users_count > @account.limits.monthly_active_users_count && "text-red-500"
(not is_nil(@active_users_count) and
@active_users_count > @account.limits.monthly_active_users_count) && "text-red-500"
]}>
{@active_users_count} used
</span>
@@ -143,8 +143,8 @@ defmodule Web.Settings.Billing do
</:label>
<:value>
<span class={[
not is_nil(@service_accounts_count) and
@service_accounts_count > @account.limits.service_accounts_count && "text-red-500"
(not is_nil(@service_accounts_count) and
@service_accounts_count > @account.limits.service_accounts_count) && "text-red-500"
]}>
{@service_accounts_count} used
</span>
@@ -158,8 +158,8 @@ defmodule Web.Settings.Billing do
</:label>
<:value>
<span class={[
not is_nil(@admins_count) and
@admins_count > @account.limits.account_admin_users_count && "text-red-500"
(not is_nil(@admins_count) and
@admins_count > @account.limits.account_admin_users_count) && "text-red-500"
]}>
{@admins_count} used
</span>
@@ -173,8 +173,8 @@ defmodule Web.Settings.Billing do
</:label>
<:value>
<span class={[
not is_nil(@gateway_groups_count) and
@gateway_groups_count > @account.limits.gateway_groups_count && "text-red-500"
(not is_nil(@gateway_groups_count) and
@gateway_groups_count > @account.limits.gateway_groups_count) && "text-red-500"
]}>
{@gateway_groups_count} used
</span>

View File

@@ -293,7 +293,7 @@ defmodule Web.Settings.IdentityProviders.Components do
~H"""
<div :if={not is_nil(@provider.last_synced_at)} class="flex items-center">
<.ping_icon color={
@provider.last_syncs_failed > 3 or (not is_nil(@provider.sync_disabled_at) && "danger") ||
(@provider.last_syncs_failed > 3 or (not is_nil(@provider.sync_disabled_at) && "danger")) ||
"success"
} />
<span class="ml-2.5">

View File

@@ -104,7 +104,7 @@ defmodule Web.AcceptanceCase.Auth do
def mock_client_sign_in_callback do
test_pid = self()
bypass = Bypass.open()
Domain.Config.put_env_override(:web, :client_handler, "http://localhost:#{bypass.port()}/")
Domain.Config.put_env_override(:web, :client_handler, "http://localhost:#{bypass.port}/")
Bypass.expect_once(bypass, "GET", "/handle_client_sign_in_callback", fn conn ->
conn = Plug.Conn.fetch_query_params(conn)