./config/application.properties included in archive

39 views
Skip to first unread message

V. Sevel

unread,
Oct 30, 2020, 12:57:28 PM10/30/20
to Quarkus Development mailing list
hello,
I created a quickstart app.
at the root of the project I added a config/application.properties file with content:
foo=bar

In the code, I have:
@ConfigProperty(name = "foo")
String foo;
...
log.info("foo=" + foo);

I build the runner: mvn clean install
if I run the runner, it prints the value as expected
then I remove the config/application.properties
and if I run the runner again, it still displays the value, which is not expected

this means that properties available in config/application.properties are picked up during the build and used as build time properties.

is that intended? or is it added by accident?
I guess I did not expect that behavior, because to me nothing other than src/main/resources should be included in the runtime.

Georgios Andrianakis

unread,
Oct 30, 2020, 6:13:16 PM10/30/20
to vvs...@gmail.com, Quarkus Development mailing list
I didn't try it, but are you absolutely certain of this?

It seems very odd that it would be happening.

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/2ff0056f-8dd1-4dfa-99fa-8276808ee633n%40googlegroups.com.

Roberto Cortez

unread,
Oct 30, 2020, 7:43:51 PM10/30/20
to gand...@redhat.com, vvs...@gmail.com, Quarkus Development mailing list
I’ve just tried it myself and I can confirm the same behaviour.

That source is added both for compile and runtime:

At this stage, I’m not sure if we should change it. It may cause additional confusion and someone may be relying on that behaviour. Currently, I’m working to make config more flexible and support user defined paths, http resources, etc, which should remove the need to rely on the external config/application.properties file.

Cheers,
Roberto

V. Sevel

unread,
Oct 31, 2020, 6:10:47 AM10/31/20
to Quarkus Development mailing list
hello,

>> At this stage, I’m not sure if we should change it. It may cause additional confusion and someone may be relying on that behaviour

I think we should :). it has been time consuming to figure out this behavior.
plus it could be dangerous. my intent was to have properties to support local testing with the runner jar. and I could have had in there: quarkus.vault.tls.skip-verify=true, and disable tls in production I suppose.
it would have been nice also to be able to change the default 'config' directory, with java -Dquarkus.config.dir=my-local-test -jar ...

one other area of improvement for k8s is passing an entire config as a single environment variable. example:

apiVersion: v1
kind: Pod
metadata:
  name: getting-started
spec:
  containers:
  - name: getting-started
    image: getting-started:1.0
    env:
    - name: QUARKUS_CONFIG_PROPERTIES
      value: |
        # Configuration file
        # key = value
        quarkus.datasource.jdbc.url=jdbc:mysql://remotehost:3306/mydatabase?useSSL=false
        foo=bar

or

    - name: QUARKUS_CONFIG_YAML
      value: |
        # Configuration file
        quarkus:
          datasource:
            db-kind: postgresql
            jdbc:
              url: jdbc:postgresql://localhost:5432/some-database
            username: quarkus
            password: quarkus
        foo: bar

this would save the effort to create a config map, and mount the application.properties in the appropriate directory.

Vincent 

Roberto Cortez

unread,
Oct 31, 2020, 1:40:30 PM10/31/20
to vvs...@gmail.com, Quarkus Development mailing list
I’m working on a separate feature to support user defined config locations that should help with these use cases:

I believe we could leave application.properties as add these additional mean to load runtime configuration.

Cheers,
Roberto 

Stuart Douglas

unread,
Nov 1, 2020, 7:20:51 PM11/1/20
to V. Sevel, Quarkus Development mailing list
Properties that are set at build time become the defaults for runtime, unless they are explicitly overridden.


Stuart

--

V. Sevel

unread,
Nov 2, 2020, 3:29:06 AM11/2/20
to Quarkus Development mailing list
>>  Properties that are set at build time become the defaults for runtime, unless they are explicitly overridden. 

Hi Stuart. I don't dispute this. What I argue is that ./config/application.properties shouldn't be part of the build. 
Vincent

Reply all
Reply to author
Forward
0 new messages