New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow admin-instance resource config #34
Comments
@tfwright - thanks a lot for your work here. Just discovered I am documenting our use case and how we got it working so someone else looking for the same thing doesn't spend too long on this. To get In config :app_a,
ecto_repos: [AppC.Repo, AppB.Repo, AppA.Repo] The reason Then, in live_admin("/admin",
resources: [
AppA.SomeSchema,
AppB.SomeSchema,
AppC.SomeSchema
]
) This works because (and I didn't know this previously), Ignore if this is known behaviour but it certainly surprised me and Kaffy's autodetection only picks up |
Definitely not expected behavior! I haven't tried to use multiple Ecto repos myself, so I'm not sure, but LiveAdmin currently executes all queries in the context of whatever repo is set in its config. I am surprised that it would work with any other repos. |
Here's a simple example that demos this behaviour: https://github.com/tejpochiraju/multi_repo_live_admin |
Hm, just a guess but I think the key implementation detail there is that the same db is being used. I think that means that even though LiveAdmin is still using the "wrong" repo when querying whatever schemas are "supposed" to be on the other repo, since the db is the same the queries end up being directed to the same place. My expectation would be if you alter the |
You are right. With separate DBs (SQLite3 or Postgres), I get the following error:
Nevertheless, this is still useful behaviour if possibly undocumented on the
EDIT
|
See #33
Problems:
right now default config must be defined at the app level, which makes it awkward to use a different set of default configs for different admin UIs (if more than 1 is desired for whatever reason).
since overrides are likely to be desired for most resources, the router config is large/noisy (see this thread)
Proposed solution: deprecate app level default config, and add support for passing a module, which specifies all configuration, including resources:
Alternatives:
It might be that these are two separate problems with config that need to be addressed separately.
The text was updated successfully, but these errors were encountered: