-
Notifications
You must be signed in to change notification settings - Fork 118
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
Provide a way to configure server for a plugin #883
Conversation
Motivation: Currently, there's no way to configure the Armeria server outside of the server module. We can perhaps do this by providing DI, SPI, and adding a method to `Plugin`. I think SPI is the most straightforward so I choosed it. We might want to change to DI later if detailed customization needs Modification: - Add `ArmeriaServerConfigurator` that is loaded via SPI and configures the Armeria Server. Result: - You can now configure the server using `ArmeriaServerConfigurator`.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #883 +/- ##
============================================
+ Coverage 65.94% 65.95% +0.01%
- Complexity 3374 3381 +7
============================================
Files 360 362 +2
Lines 14020 14037 +17
Branches 1502 1503 +1
============================================
+ Hits 9245 9258 +13
- Misses 3919 3924 +5
+ Partials 856 855 -1
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me 👍 Thanks @minwoox 🙇 👍 🙇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @minwoox!
/** | ||
* Creates a new instance. | ||
*/ | ||
public PluginInitContext(CentralDogmaConfig config, ServerBuilder serverBuilder) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public PluginInitContext(CentralDogmaConfig config, ServerBuilder serverBuilder) { | |
PluginInitContext(CentralDogmaConfig config, ServerBuilder serverBuilder) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I cannot remove the public modifier because the class is in a different package.
/** | ||
* A context that is used to pass when calling {@link AllReplicasPlugin#init(PluginInitContext)}. | ||
*/ | ||
public final class PluginInitContext { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question) I was thinking we would need at least ProjectManager
, CommandExecutor
will be needed to build services which can write to CentralDogma
storage. Is there no need for these values? (it looks like they are available at init time).
I actually expect we may also want access to MeterRegistry
, and actually all values in PluginContext
eventually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I thought somehow they are not created when the init method is called. 😅
Let me fix that. 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. PTAL. 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about the late check! Looks good to me! 🙇 👍 🚀
Let me merge this for now to keep working on the control plane. |
Motivation:
Currently, there's no way to configure the Armeria server outside of the server module. We can perhaps do this by providing DI, SPI, or adding a method to
Plugin
.Modification:
AllReplicasPlugin
class for configuring Central Dogma serverResult:
AllReplicasPlugin.init()
method.