Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

application.properties completion with custom config mapping #940

Open
f41thpl4tt opened this issue Jan 23, 2025 · 0 comments
Open

application.properties completion with custom config mapping #940

f41thpl4tt opened this issue Jan 23, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@f41thpl4tt
Copy link

AppConfig.java

package app;

import java.util.Optional;

import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;

@ConfigMapping(prefix = "o-sso")
public interface AppConfig {

    @WithDefault("300")
    int tokenDuration();

    Provider prov1();

    Provider prov2();

    interface Provider {
        @WithDefault("false")
        boolean allowAll();

        @WithDefault("false")
        boolean enabled();

        Optional<String> whiteList();

        Optional<String> cert();

        @WithDefault("ANY")
        Env env();

        Optional<Integer> tokenDuration();

        default boolean isActivated() {
            return enabled() && (whiteList().isPresent() || cert().isPresent());
        }

        enum Env {
            PROD, STAGING, ANY
        }
    }
}

When I try to write in my application.properties file, beginning with 'o-sso', only keys for my first "Provider" appears:

o-sso.prov1.allow-all
o-sso.prov1.cert
o-sso.prov1.enabled
o-sso.prov1.white-list
o-sso.token-duration

What I expected:

o-sso.prov1.allow-all
o-sso.prov1.cert
o-sso.prov1.enabled
o-sso.prov1.white-list
o-sso.prov2.allow-all
o-sso.prov2.cert
o-sso.prov2.enabled
o-sso.prov2.white-list
o-sso.token-duration
@angelozerr angelozerr self-assigned this Jan 23, 2025
@angelozerr angelozerr added the bug Something isn't working label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants