ash_authentication/dev/dev_server.ex
James Harton 8797005175
feat(Ash.PlugHelpers): Support standard actor configuration. (#16)
* improvement(docs): change all references to `actor` to `user`.

The word "actor" has special meaning in the Ash ecosystem.

* chore: format `dev` directory also.

* feat(Ash.PlugHelpers): Support standard actor configuration.

* Adds the `:set_actor` plug which will set the actor to a resource based on the subject name.
* Also includes GraphQL and JSON:API interfaces in the devserver for testing.
2022-10-31 16:43:00 +13:00

24 lines
597 B
Elixir

defmodule DevServer do
@moduledoc """
This module provides an extremely simplified authentication UI, mainly for
local development and testing.
"""
use Supervisor
def start_link(init_arg), do: Supervisor.start_link(__MODULE__, init_arg, name: __MODULE__)
@impl true
def init(_init_arg) do
opts =
:ash_authentication
|> Application.get_env(DevServer, [])
|> Keyword.delete(:start?)
[
{DevServer.Session, []},
{Plug.Cowboy, scheme: :http, plug: DevServer.Router, options: opts}
]
|> Supervisor.init(strategy: :one_for_all)
end
end