summaryrefslogtreecommitdiff
path: root/lib
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 /lib
parentadd gitlab-ci.yml (diff)
run mix format
Diffstat (limited to 'lib')
-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
3 files changed, 9 insertions, 5 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