Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine programmatically the current active profiles in Quarkus

Tags:

quarkus

In the Quarkus Application Configuration Guide it mentions how to configure an app with profiles (eg. %dev.quarkus.http.port=8181).

But is there a way to access a Profile (or Environment) API so I can log the active profiles ? For example something like Spring:

@ApplicationScoped
public class ApplicationLifeCycle {

    private static final Logger LOGGER = LoggerFactory.getLogger("ApplicationLifeCycle");

    @Inject Environment env;

    void onStart(@Observes StartupEvent ev) {
        LOGGER.info("The application is starting with profiles " + env.getActiveProfiles());
    }
like image 621
agoncal Avatar asked Jun 16 '19 09:06

agoncal


1 Answers

ProfileManager.getActiveProfile()?

like image 153
Romain Manni-Bucau Avatar answered Oct 19 '22 12:10

Romain Manni-Bucau