Search code examples
javaloggingconfigquarkussmallrye

How to overwrite config in a Quarkus extension


Is there a way to overwrite a configuration in a Quarkus extension with a hard-coded value?

What I'm trying to do: I am creating a custom Quarkus extension for JSON logging, based on quarkus-logging-json but with additional (non static) fields. I reuse some classes from the extension's runtime library, so it is a Maven dependency of the runtime module of the extension (and the deployment also needs to be declared as a dependency to my deployment module, because the quarkus extension plugin checks this). It seems to work fine, except that I now have 2 formatters, and the following line is logged:

LogManager error of type GENERIC_FAILURE: Multiple console formatters were activated

I would like to disable the quarkus-logging-json extension completely by hard-coding these values:

quarkus.console.json.enable=false 
quarkus.file.json.enable=false. 

Is there a way to do this?

Thank you.


Solution

  • An extension cannot override runtime configuration values, it can however set a default value using io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem