Integration into the host's router.
Place it in a scope going through a pipeline with a session
(fetch_session), typically :browser, and behind a dev-only guard:
if Application.compile_env(:my_app, :dev_routes) do
import GreenAsh.Router
scope "/" do
pipe_through :browser
green_ash "/cli"
end
endGate it
The console has no access control of its own. It lists, creates, updates
and deletes any record of any exposed resource, and :actor loads any
record as the current actor — impersonation is the point of the tool.
Reachable in production, it is an unauthenticated admin panel over your
whole domain. mix green_ash.install writes the guard above for you;
mounting by hand is the path where nothing does.
By default, the exposed domains are read dynamically, on every request
from Application.get_env(:my_app, :ash_domains, []) — the same config key
that mix ash.setup/mix ash.codegen already use. Adding a domain to this
list (which the Ash generators themselves do) is enough to make it appear
in the console, with no need to touch the router or rerun the installer.
domains: remains available to explicitly pin a subset (or if your domains
are not declared under the standard key):
green_ash "/cli", domains: [MyApp.Bank, MyApp.Sales]
Summary
Functions
Mounts the console under path, in the current scope.
Functions
Mounts the console under path, in the current scope.
Options
:domains— explicit list ofAsh.Domainmodules to expose. If omitted (recommended), read dynamically fromApplication.get_env(otp_app, :ash_domains, []).:otp_app— OTP application from which to read:ash_domainsby default. Inferred automatically (Mix.Project.config()[:app]) if omitted.