From 8ccbce83a522a52ce4d1238e823ffcfe3c157ce3 Mon Sep 17 00:00:00 2001 From: Pierre de Lacroix Date: Sat, 27 Jun 2020 00:04:50 +0000 Subject: fetch env at runtime only --- lib/matrix_app_service/auth_plug.ex | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/matrix_app_service/auth_plug.ex b/lib/matrix_app_service/auth_plug.ex index 529cefd..c3fcb71 100644 --- a/lib/matrix_app_service/auth_plug.ex +++ b/lib/matrix_app_service/auth_plug.ex @@ -4,12 +4,13 @@ defmodule MatrixAppService.AuthPlug do require Logger @impl Plug - def init(_opts) do - Application.fetch_env!(:matrix_app_service, :homeserver_token) + def init(opts) do + opts end @impl Plug - def call(%Plug.Conn{params: %{"access_token" => hs_token}} = conn, config_hs_token) do + 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 -- cgit v1.2.3