Skip to content
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

Accessing runtime configuration during build time #42985

Open
radcortez opened this issue Sep 3, 2024 · 0 comments
Open

Accessing runtime configuration during build time #42985

radcortez opened this issue Sep 3, 2024 · 0 comments
Labels
area/config kind/enhancement New feature or request

Comments

@radcortez
Copy link
Member

radcortez commented Sep 3, 2024

Description

Currently, we do not officially support accessing runtime configuration during build time, but unofficially we do it.

When we map a configuration with either ConfigPhase#BUILD_TIME, ConfigPhase#BUILD_AND_RUN_TIME_FIXED, or ConfigPhase#RUN_TIME, it tells us where the configuration may be applied, and we do some validations on top. For instance, if someone tries to set a configuration during runtime that is marked ConfigPhase#BUILD_AND_RUN_TIME_FIXED, you get a warning:

foo.bar is set to 'runtime', but it is build-time fixed to 'build'. Did you change the property foo.bar after building the application?

But we don't have the opposite (validate that we are accessing runtime configuration available during build time), so it is possible to do it. One example is Dev Services:

  • Dev Services do the work during build-time
  • We check for a well-known service configuration (like ...url or similar), which in most cases is a runtime property.
  • If the property is there, we move on; if not, we try to be smart and start the Dev Service

This has been causing some annoying issues (and probably more):

Checking for runtime properties during build is error-prone, obviously because the runtime configuration may be completely different.

There are other scenarios where we access runtime configuration to populate / generate descriptions that later on are again updated at runtime on configuration change. Still, I didn't identify all of these scenarios yet.

Implementation ideas

What should we do?

  • Leave it as is and acknowledge the status quo, properly document and support it. I don't want to complicate things, but we should mark such configuration properties and lock and warn against unexpected access. Cases such as Expanding ${keycloak.url}/realms/quarkus/ when keycloak.url is not defined leads to null value #42392 (comment) are not going to work.

  • Dumb down Dev Services and always enable them during Dev mode. To connect to a specific service, you must disable that Dev Service explicitly. It will worsen the experience, but it is the easiest solution I can think of. I still need to analyze other scenarios where runtime properties are used during build-time.

  • Maybe we can change the Dev Services configuration slightly. We still do all the work, but config verification would happen at runtime. I didn't do any analysis to check if this is feasible or not. There may be other requirements that I'm not fully aware.

Regardless, this is for us to start a conversation on the matter and see if we need to change something.

@radcortez radcortez added the kind/enhancement New feature or request label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant