-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Extension to view MicroProfile config values in dev mode #5692
Conversation
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.
I'm not sure if we need some extension metadata to indicate that this is dev only, if that's possible?
extensions/pom.xml
Outdated
@@ -87,7 +88,6 @@ | |||
<module>spring-di</module> | |||
<module>spring-web</module> | |||
<module>spring-data-jpa</module> | |||
<module>spring-security</module> |
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.
are these modules meant to be removed?
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.
Should be fixed now.
* } | ||
* </pre> | ||
*/ | ||
@WebServlet |
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.
Ideally I think this should be a pure Vert.x Handler like Health and Metrics: https://github.com/quarkusio/quarkus/blob/master/extensions/smallrye-health/runtime/src/main/java/io/quarkus/smallrye/health/runtime/SmallRyeHealthHandler.java
And thus change the dependency from undertow to vertx. That's going to be the lowest common denominator
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.
I'm using a pure Vert.x handler now.
|
||
import org.eclipse.microprofile.config.Config; | ||
|
||
public class ConfigHolder { |
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.
This shouldn't be needed IIUC, you could just pull Config
out of CDI.current() instead of wrapping in this class
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.
Ok, I'll try to simplify 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.
Removed ConfigHolder
.
Looks nice! I am wondering if this could be part of the standard dev mode experience without the user having to add another extension to have access to the view. |
@hpehl did you perhaps look into having this available in dev mode by default without requiring the user to add an extra dependency? |
Sounds reasonable. |
I was think that if the code could live in the |
Ok. I'm going to refactor and update the PR. |
@hpehl thanks! Best have the refactoring in a separate commit in case someone else comes up with a good reason why this change shouldn't be in the core devmode code. Thanks |
@geoand Adding the code directly in DevModeMain.java:167 String configPath = buildSystemProperties.getProperty("quarkus.config.path", "/config");
builder.addChainCustomizer(new Consumer<BuildChainBuilder>() {
@Override
public void accept(BuildChainBuilder buildChainBuilder) {
buildChainBuilder.addBuildStep(new BuildStep() {
@Override
public void execute(BuildContext context) {
// this would add dependencies to quarkus-vertx-http and quarkus-jsonp
context.produce(new RouteBuildItem(configPath, new ConfigViewerHandler(), HandlerType.BLOCKING));
}
});
}
}); Are there other ways to get this into |
@geoand should we try to get that one into 1.3? It looks useful. |
Yeah it would definitely be nice to have. vertx-http (or perhaps it's internal version) should already be a dependency of the dev-mode, so I don't think that should be a problem. |
So should this be closed now? |
Superseded by #7430 |
PR for #1349.
Adds a servlet in dev mode which lists the configured values for MicroProfile Configuration. The servlet is registered using the path /config by default and lists all properties of all config sources. The config sources are sorted descending by ordinal, the properties by name. If no config is defined an empty JSON object is returned.
There's no integration test in this PR. Since the servlet is only added in dev mode, @QuarkusTest does not work as expected.
If necessary I can provide documentation.