1

I'm trying to override configuration properties via environment variables on Quarkus application, compiled and dockerized with native profile.

When I exec into my container, and check the environment variables, I can confirm that the value I expect is there.

In my quarkus app, I have a bean which will log the config properties at startup.

@ApplicationScoped
public class AppLifecycleBean {

    @Inject
    Configuration configuration;

    void onStart(@Observes StartupEvent ev) {
        System.out.println("The application is starting...");
        System.out.println(configuration.toString());
    }

    void onStop(@Observes ShutdownEvent ev) {
        System.out.println("The application is stopping...");
    }

}

The Configuration class looks like this.

@Singleton
public class Configuration {

    @ConfigProperty(name = "quarkus.profile")
    public String quarkusProfile;
    ...

    @Override
    public String toString() {
        return "Configuration:\n" +
                "quarkusProfile='" + quarkusProfile + "'\n" +
                ...
    }
}

Deploying with Kubernetes, I pass a value for env var QUARKUS_PROFILE of 'FR2', but I still get prod. Is it not possible to override config properties via environment variables with native images ?

Anthony Richir
  • 649
  • 2
  • 8
  • 31
  • How are you overriding the environment variable? Do you have code that actually prints that value inside the application? – geoand Oct 06 '22 at 05:30
  • Yes, it's the code in my question. From the documentation https://quarkus.io/guides/config-reference#configuration-sources, I understand that values set by env var have priority on the application.properties. Therefore, the code should print the value from the env var, but it doesn't, it still uses the one from application.properties – Anthony Richir Oct 06 '22 at 12:50

0 Answers0