Packages

Build Matrix Application Services (bridges, bots...) in Elixir.

Current section

Files

Jump to
matrix_app_service lib matrix_app_service_web set_config_plug.ex
Raw

lib/matrix_app_service_web/set_config_plug.ex

defmodule MatrixAppServiceWeb.SetConfigPlug do
@moduledoc """
"""
@behaviour Plug
import Plug.Conn
require Logger
@doc false
@impl Plug
def init(opts) do
opts
end
@doc false
@impl Plug
def call(conn, opts) do
conn
|> put_private(:transaction_adapter, Keyword.fetch!(opts, :transaction_adapter))
|> put_private(:room_adapter, Keyword.fetch!(opts, :room_adapter))
|> put_private(:user_adapter, Keyword.fetch!(opts, :user_adapter))
|> put_private(:homeserver_token, Keyword.fetch!(opts, :homeserver_token))
|> put_private(:access_token, Keyword.fetch!(opts, :access_token))
|> put_private(:base_url, Keyword.fetch!(opts, :base_url))
|> put_private(:path, Keyword.fetch!(opts, :path))
end
end