andyl
andyl
AEAsh Elixir
Created by andyl on 5/25/2025 in #support
Reusable Ash Resources
I've got a commonly-used Ash resource that I'd like to put in an Elixir package for reuse across Phoenix apps. Is anyone doing this? Can anyone point me towards examples or best practice? This works, but the otp_app is hardcoded:
defmodule Packaged.Resource do
use Ash.Resource, domain: Packaged.Domain, otp_app: :consumer_app
end
defmodule Packaged.Resource do
use Ash.Resource, domain: Packaged.Domain, otp_app: :consumer_app
end
This fails:
defmodule Packaged.Resource do
use Ash.Resource, domain: Packaged.Domain, otp_app: Application.get_application(__MODULE__)
end
defmodule Packaged.Resource do
use Ash.Resource, domain: Packaged.Domain, otp_app: Application.get_application(__MODULE__)
end
Ash compilation seems to require static configuration for otp_app. Is that right?
10 replies