refactor: move route plugins to Nova global config#61
Merged
Conversation
Remove per-group plugin definitions from asobi_router route groups
and move them to {nova, [{plugins, [...]}]} in sys.config. This
allows wrapper applications (like asobi_engine) to control the
plugin chain via their own Nova config when using asobi as a
nova_app, enabling injection of additional plugins (e.g. tenant
resolution) without duplicating all route definitions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
plugins =>from all asobi_router route groups{nova, [{plugins, [...]}]}in dev and prod sys.configWhy
Wrapper applications (e.g. asobi_engine for SaaS) need to inject additional plugins (tenant resolution) into all routes. With per-group plugins hardcoded in the router, the only option was duplicating all route definitions. Nova's global plugin mechanism (
application:get_env(nova, plugins, [])) is used as fallback when route groups don't define their own — by removing per-group definitions, wrapper apps can now control the full plugin chain via their Nova config.Test plan
rebar3 compile— cleanrebar3 fmt --check— cleanrebar3 xref— clean_checkouts: global plugins apply to all asobi routes, tenant plugin injects correctly, 15 tests pass