summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre de Lacroix <pierre@pdelacroix.com>2020-09-17 23:07:36 +0200
committerPierre de Lacroix <pierre@pdelacroix.com>2020-09-17 23:07:36 +0200
commit5527b80ddc075da0a1a4a3780a6f86d2a0eb45c7 (patch)
treee60932b4b28a8129089eea917692c95d450c8872
parentadd gitlab-ci.yml (diff)
run mix format
-rw-r--r--lib/matrix_app_service/application.ex12
-rw-r--r--lib/matrix_app_service/auth_plug.ex1
-rw-r--r--lib/matrix_app_service/phoenix/router.ex1
-rw-r--r--mix.exs2
-rw-r--r--test/matrix_app_service_web/views/error_view_test.exs4
5 files changed, 13 insertions, 7 deletions
diff --git a/lib/matrix_app_service/application.ex b/lib/matrix_app_service/application.ex
index 02d17f2..57ce521 100644
--- a/lib/matrix_app_service/application.ex
+++ b/lib/matrix_app_service/application.ex
@@ -16,11 +16,13 @@ defmodule MatrixAppService.Application do
# Start a worker by calling: MatrixAppService.Worker.start_link(arg)
# {MatrixAppService.Worker, arg}
]
- children = if Application.get_env(:matrix_app_service, :standalone, false) do
- [MatrixAppServiceWeb.Endpoint | children]
- else
- children
- end
+
+ children =
+ if Application.get_env(:matrix_app_service, :standalone, false) do
+ [MatrixAppServiceWeb.Endpoint | children]
+ else
+ children
+ end
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
diff --git a/lib/matrix_app_service/auth_plug.ex b/lib/matrix_app_service/auth_plug.ex
index c3fcb71..8adbc91 100644
--- a/lib/matrix_app_service/auth_plug.ex
+++ b/lib/matrix_app_service/auth_plug.ex
@@ -11,6 +11,7 @@ defmodule MatrixAppService.AuthPlug do
@impl Plug
def call(%Plug.Conn{params: %{"access_token" => hs_token}} = conn, _) do
config_hs_token = Application.fetch_env!(:matrix_app_service, :homeserver_token)
+
with ^config_hs_token <- hs_token do
conn
else
diff --git a/lib/matrix_app_service/phoenix/router.ex b/lib/matrix_app_service/phoenix/router.ex
index a5458d2..2a4aba6 100644
--- a/lib/matrix_app_service/phoenix/router.ex
+++ b/lib/matrix_app_service/phoenix/router.ex
@@ -7,6 +7,7 @@ defmodule MatrixAppService.Phoenix.Router do
end
path = Application.compile_env(:matrix_app_service, :path, "/")
+
scope path, MatrixAppServiceWeb.V1 do
pipe_through :matrix_api
diff --git a/mix.exs b/mix.exs
index fab88bd..88cf1aa 100644
--- a/mix.exs
+++ b/mix.exs
@@ -39,7 +39,7 @@ defmodule MatrixAppService.MixProject do
{:telemetry_poller, "~> 0.4"},
{:jason, "~> 1.0"},
{:plug_cowboy, "~> 2.0"},
- {:polyjuice_client, "~> 0.2.3"},
+ {:polyjuice_client, "~> 0.2.3"}
]
end
diff --git a/test/matrix_app_service_web/views/error_view_test.exs b/test/matrix_app_service_web/views/error_view_test.exs
index fb0d11e..e23078a 100644
--- a/test/matrix_app_service_web/views/error_view_test.exs
+++ b/test/matrix_app_service_web/views/error_view_test.exs
@@ -5,7 +5,9 @@ defmodule MatrixAppServiceWeb.ErrorViewTest do
import Phoenix.View
test "renders 404.json" do
- assert render(MatrixAppServiceWeb.ErrorView, "404.json", []) == %{errors: %{detail: "Not Found"}}
+ assert render(MatrixAppServiceWeb.ErrorView, "404.json", []) == %{
+ errors: %{detail: "Not Found"}
+ }
end
test "renders 500.json" do