Skip to content

Commit 6b71c87

Browse files
committed
Document ConfigUtils.getProfiles
1 parent 8422ed3 commit 6b71c87

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,26 @@ public static SmallRyeConfigBuilder emptyConfigBuilder() {
3434
.addDefaultSources();
3535
}
3636

37+
/**
38+
* Returns a {@code List} of the active profiles in Quarkus.
39+
* <p>
40+
* Profiles are sorted in reverse order according to how they were set in
41+
* {@code quarkus.profile}, as the last profile overrides the previous one until there are
42+
* no profiles left in the list.
43+
*
44+
* @return a {@code List} of the active profiles
45+
* @see io.smallrye.config.SmallRyeConfig#getProfiles()
46+
*/
3747
public static List<String> getProfiles() {
3848
return ConfigProvider.getConfig().unwrap(SmallRyeConfig.class).getProfiles();
3949
}
4050

51+
/**
52+
* Check if a configuration profile is active in Quarkus.
53+
*
54+
* @param profile the configuration profile to check
55+
* @return true if the profile is active or false otherwise.
56+
*/
4157
public static boolean isProfileActive(final String profile) {
4258
return getProfiles().contains(profile);
4359
}

docs/src/main/asciidoc/config-reference.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ Setting `quarkus.profile` to `staging` will activate the `staging` profile.
367367

368368
[NOTE]
369369
====
370-
The `io.smallrye.config.SmallRyeConfig#getProfiles` API provides a way to retrieve the active profiles programmatically.
370+
The `io.quarkus.runtime.configuration.ConfigUtils.getProfiles` API provides a way to retrieve the active profiles programmatically.
371371
====
372372

373373
=== Profile-aware files

0 commit comments

Comments
 (0)