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

ConfigProperty persisting after build #970

Closed
afonsonf opened this issue Aug 3, 2023 · 2 comments
Closed

ConfigProperty persisting after build #970

afonsonf opened this issue Aug 3, 2023 · 2 comments

Comments

@afonsonf
Copy link

afonsonf commented Aug 3, 2023

Hi,

I have noticed that on quarkus versions after 3.0.0.CR1 config properties set on build are persisted when running the resulting package, which was not the behaviour in quarkus 2. (which I think corresponds to the update to smallrye-config version 3.2.0)

The example I have is when we have a ConfigProperty and set it using an env variable during build time, then when running the application the ConfigProperty is still set even without any env variable.

Reproducer: https://github.com/afonsonf/quarkus-config-cdi

With Quarkus 2 config is empty: https://github.com/afonsonf/quarkus-config-cdi/actions/runs/5756295370/job/15605429637#step:5:8
With Quarkus 3.0.0.Beta1 config is empty: https://github.com/afonsonf/quarkus-config-cdi/actions/runs/5756307141/job/15605462090#step:5:8
With Quarkus 3.0.0.CR1 config is set: https://github.com/afonsonf/quarkus-config-cdi/actions/runs/5756323176/job/15605506130#step:5:8

Is this expected behaviour or a bug? If it is expected how would I add such a config that is not persisted?

@radcortez
Copy link
Member

Is this expected behaviour or a bug? If it is expected how would I add such a config that is not persisted?

Depends... Quarkus has a feature to record configuration during the build in the resulting jar (or native image). The goal is to provide the configuration in runtime if somehow it becomes missing from one environment to another (and not fail the application). But the recording, only applies to @ConfigMapping definitions, so the properties solely used in @ConfigProperty or programmatically should not be recorded.

The issue is not related with SmallRye Config, but it was added during the update:
quarkusio/quarkus#31824

This should fix it:
quarkusio/quarkus#35210

@afonsonf
Copy link
Author

afonsonf commented Aug 4, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants