Skip to content

Enhance SmallRyeConfig handling  #41994

@zakkak

Description

@zakkak

Description

As discussed in https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/Best.20way.20to.20get.20config.20profile.20in.20a.20BuildStep.3F

Quarkus currently processes configuration in the deployment stage and generates a bytecode recorded class handling all the necessary configuration thus no longer relying (in theory at least) on the actual configuration files, except for dev mode maybe where Quarkus needs to detect changes to the configuration files and update the configuration.

In native-mode this bytecode recorded class is the only source of configuration (as the configuration files don't get embed in the native executable). In JVM-mode though it looks like that configuration files may still be available. This discrepancy enables JVM-mode to change profiles on the fly, which while not forbidden in native-mode it essentially has no effect as the bytecode recorded class is based on a specific profile and a warning is thrown to let the user know.

This leads to the following questions:

  1. What has higher priority the recorded bytecode or the configuration files?
  2. What happens when we change the profile in JVM-mode? Does the bytecode recorded configuration get replaced by the runtime loaded configuration?
  3. If the configuration files are reachable, isn't SmallRye loading them? Essentially beating the purpose of the bytecode recorded class in the first place?

Implementation ideas

@radcortez suggested disabling SmallRye discovery of configuration files for non-dev, non-test modes. Adding a note that "the discovery class, also looks for external files in a config folder sitting in the working directory, we don't have a way to fine tune. either it is enabled for classpath and folder discovery or none, we would need to enhance it to support it properly"

@zakkak suggested stripping the configuration files after deployment is done

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions