Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 52c89bd

Browse files
committedDec 15, 2024·
Update versions
1 parent f75fff1 commit 52c89bd

File tree

17 files changed

+93
-91
lines changed

17 files changed

+93
-91
lines changed
 

Diff for: ‎Dockerfile

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
FROM hexpm/elixir:1.13.4-erlang-24.3.3-alpine-3.15.3 as build
1+
ARG ELIXIR_VERSION=1.17.3
2+
ARG ERLANG_VERSION=27.2
3+
ARG ALPINE_VERSION=3.20.3
4+
5+
FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-alpine-${ALPINE_VERSION} AS build
26

37
# install build dependencies
48
RUN apk add --no-cache --update git build-base nodejs yarn
@@ -35,7 +39,7 @@ COPY rel rel
3539
RUN mix do sentry.package_source_code, release
3640

3741
# prepare release image
38-
FROM alpine:3.15.3 AS app
42+
FROM alpine:${ALPINE_VERSION} AS app
3943
RUN apk add --no-cache --update bash openssl git libstdc++
4044

4145
RUN mkdir /app

Diff for: ‎config/config.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# is restricted to this project.
66

77
# General application configuration
8-
use Mix.Config
8+
import Config
99

1010
config :diff,
1111
cache_version: 2,

Diff for: ‎config/dev.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use Mix.Config
1+
import Config
22

33
# For development, we disable any cache and enable
44
# debugging and code reloading.

Diff for: ‎config/prod.exs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use Mix.Config
1+
import Config
22

33
# For production, don't forget to configure the url host
44
# to something meaningful, Phoenix uses this information
@@ -12,7 +12,6 @@ use Mix.Config
1212
config :diff, DiffWeb.Endpoint,
1313
http: [compress: true],
1414
url: [scheme: "https", port: 443],
15-
load_from_system_env: true,
1615
cache_static_manifest: "priv/static/cache_manifest.json"
1716

1817
config :diff,

Diff for: ‎config/releases.exs

-17
This file was deleted.

Diff for: ‎config/runtime.exs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import Config
2+
3+
if config_env() == :prod do
4+
config :diff,
5+
host: System.fetch_env!("DIFF_HOST"),
6+
hexpm_host: System.fetch_env!("DIFF_HEXPM_HOST"),
7+
cache_version: String.to_integer(System.fetch_env!("DIFF_CACHE_VERSION")),
8+
bucket: System.fetch_env!("DIFF_BUCKET")
9+
10+
config :diff, DiffWeb.Endpoint,
11+
http: [port: String.to_integer(System.fetch_env!("DIFF_PORT"))],
12+
url: [host: System.fetch_env!("DIFF_HOST")],
13+
secret_key_base: System.fetch_env!("DIFF_SECRET_KEY_BASE")
14+
15+
config :goth, json: System.fetch_env!("DIFF_GCP_CREDENTIALS")
16+
17+
config :sentry,
18+
dsn: System.fetch_env!("DIFF_SENTRY_DSN"),
19+
environment_name: System.fetch_env!("DIFF_ENV")
20+
21+
config :kernel,
22+
inet_dist_listen_min: String.to_integer(System.fetch_env!("BEAM_PORT")),
23+
inet_dist_listen_max: String.to_integer(System.fetch_env!("BEAM_PORT"))
24+
end

Diff for: ‎config/test.exs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use Mix.Config
1+
import Config
22

33
# We don't run a server during test. If one is required,
44
# you can enable the server option below.
@@ -9,7 +9,7 @@ config :diff, DiffWeb.Endpoint,
99
config :goth, config: %{"project_id" => "diff"}
1010

1111
# Print only warnings and errors during test
12-
config :logger, level: :warn
12+
config :logger, level: :warning
1313

1414
config :diff,
1515
package_store_impl: Diff.Package.StoreMock,

Diff for: ‎lib/diff/http.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ defmodule Diff.HTTP do
8282
end
8383

8484
defp do_retry(fun, service, times, reason) do
85-
Logger.warn("#{service} API ERROR: #{inspect(reason)}")
85+
Logger.warning("#{service} API ERROR: #{inspect(reason)}")
8686

8787
if times + 1 < @max_retry_times do
8888
sleep = trunc(:math.pow(3, times) * @base_sleep_time)

Diff for: ‎lib/diff/storage/gcs.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ defmodule Diff.Storage.GCS do
4444
end
4545

4646
defp headers() do
47-
{:ok, token} = Goth.Token.for_scope(@oauth_scope)
47+
token = Goth.fetch!(@oauth_scope)
4848
[{"authorization", "#{token.type} #{token.token}"}]
4949
end
5050

Diff for: ‎lib/diff_web.ex

+4-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ defmodule DiffWeb do
4444
def live_view do
4545
quote do
4646
use Phoenix.LiveView,
47-
layout: {DiffWeb.LayoutView, "live.html"}
47+
layout: {DiffWeb.LayoutView, :live}
4848

4949
unquote(view_helpers())
5050
end
@@ -79,7 +79,9 @@ defmodule DiffWeb do
7979
defp view_helpers do
8080
quote do
8181
# Use all HTML functionality (forms, tags, etc)
82-
use Phoenix.HTML
82+
import Phoenix.HTML
83+
import Phoenix.HTML.Form
84+
use PhoenixHTMLHelpers
8385

8486
# Import LiveView helpers (live_render, live_component, live_patch, etc)
8587
import Phoenix.LiveView.Helpers

Diff for: ‎lib/diff_web/endpoint.ex

+1-22
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ defmodule DiffWeb.Endpoint do
2626

2727
plug DiffWeb.Plugs.Status
2828
plug Plug.RequestId
29-
plug Logster.Plugs.Logger, excludes: [:params]
29+
plug Logster.Plugs.Logger, excludes: [:params], log: :info
3030

3131
plug Plug.Parsers,
3232
parsers: [:urlencoded, :multipart, :json],
@@ -50,25 +50,4 @@ defmodule DiffWeb.Endpoint do
5050
end
5151

5252
plug DiffWeb.Router
53-
54-
def init(_key, config) do
55-
if config[:load_from_system_env] do
56-
port = System.fetch_env!("DIFF_PORT")
57-
58-
case Integer.parse(port) do
59-
{_int, ""} ->
60-
host = Application.fetch_env!(:diff, :host)
61-
secret_key_base = System.fetch_env!("DIFF_SECRET_KEY_BASE")
62-
config = put_in(config[:http][:port], port)
63-
config = put_in(config[:url][:host], host)
64-
config = put_in(config[:secret_key_base], secret_key_base)
65-
{:ok, config}
66-
67-
:error ->
68-
{:ok, config}
69-
end
70-
else
71-
{:ok, config}
72-
end
73-
end
7453
end

Diff for: ‎lib/diff_web/gettext.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ defmodule DiffWeb.Gettext do
2020
2121
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
2222
"""
23-
use Gettext, otp_app: :diff
23+
use Gettext.Backend, otp_app: :diff
2424
end

Diff for: ‎lib/diff_web/plugs/forwarded.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ defmodule DiffWeb.Plugs.Forwarded do
2121
parsed_ip
2222

2323
{:error, _} ->
24-
Logger.warn("Invalid IP: #{inspect(ip)}")
24+
Logger.warning("Invalid IP: #{inspect(ip)}")
2525
nil
2626
end
2727
end

Diff for: ‎lib/diff_web/views/error_helpers.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule DiffWeb.ErrorHelpers do
33
Conveniences for translating and building error messages.
44
"""
55

6-
use Phoenix.HTML
6+
use PhoenixHTMLHelpers
77

88
@doc """
99
Generates tag for inlined form input errors.

Diff for: ‎mix.exs

+8-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ defmodule Diff.MixProject do
77
version: "0.1.0",
88
elixir: "~> 1.10",
99
elixirc_paths: elixirc_paths(Mix.env()),
10-
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
1110
start_permanent: Mix.env() == :prod,
1211
aliases: aliases(),
1312
releases: releases(),
@@ -34,19 +33,21 @@ defmodule Diff.MixProject do
3433
# Type `mix help deps` for examples and options.
3534
defp deps do
3635
[
37-
{:floki, "~> 0.32.0"},
36+
{:floki, "~> 0.37.0"},
3837
{:gettext, "~> 0.11"},
3938
{:git_diff, github: "ericmj/git_diff", branch: "ericmj/fix-modes"},
4039
{:goth, "~> 1.0"},
4140
{:hackney, "~> 1.15"},
42-
{:hex_core, "~> 0.8.0"},
41+
{:hex_core, "~> 0.11.0"},
4342
{:jason, "~> 1.0"},
44-
{:logster, "~> 1.0"},
45-
{:mox, "~> 1.0.0", only: :test},
46-
{:phoenix_html, "~> 3.2"},
43+
{:logster, "~> 1.0.0"},
44+
{:mox, "~> 1.0", only: :test},
45+
{:phoenix_html, "~> 4.0"},
46+
{:phoenix_html_helpers, "~> 1.0"},
4747
{:phoenix_live_reload, "~> 1.2", only: :dev},
48-
{:phoenix_live_view, "~> 0.6"},
48+
{:phoenix_live_view, "~> 1.0"},
4949
{:phoenix_pubsub, "~> 2.0"},
50+
{:phoenix_view, "~> 2.0"},
5051
{:phoenix, "~> 1.6"},
5152
{:plug_cowboy, "~> 2.1"},
5253
{:sentry, "~> 10.2"}

Diff for: ‎mix.lock

+39-29
Large diffs are not rendered by default.

Diff for: ‎test/diff_web/live/search_view_test.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ defmodule DiffWeb.SearchLiveViewTest do
6464
send(view.pid, {:search, "phoenix"})
6565

6666
assert render_click(view, "go", %{result: "phoenix", to: "1.4.11", from: "1.4.10"}) ==
67-
{:error, {:redirect, %{to: "/diff/phoenix/1.4.10..1.4.11"}}}
67+
{:error, {:redirect, %{to: "/diff/phoenix/1.4.10..1.4.11", status: 302}}}
6868
end
6969

7070
test "no duplicates for suggestions", %{conn: conn} do

0 commit comments

Comments
 (0)
Please sign in to comment.