Skip to content

Doc improve section about active profiles programmatic access #45941

@Postremus

Description

@Postremus

Description

I wanted to activate a feature in my app only when dev mode is active.
The class is not a cdi bean (OASFilter), so IfBuildProfile does not help me.

I did not quite remember the manual way to check profiles, and tried to look it up in the doc.
ConfigProvider.getConfig().unwrap(SmallRyeConfig.class).getProfiles() states to use io.smallrye.config.SmallRyeConfig#getProfiles to retrieve the currently active profiles.

However, that is a bit confusing imo. SmallRyeConfig#getProfiles is not a static method, and therer is no doc on that class on how to obtain an instance.

After a bit of searching I found ConfigUtils.getProfiles() which does a simple unwrap / cast.
ConfigProvider.getConfig().unwrap(SmallRyeConfig.class).

The doc could be a bit more clearer on how to get the active profiles.

Implementation ideas

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions