-
Notifications
You must be signed in to change notification settings - Fork 115
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
Allow creating an alias for configuration names #339
Comments
You can already do this with variable replacement, isn't? |
@OndrejM can you elaborate your user case? Where do you put the alias? |
Here's an example how I use injected REST client in an app: https://github.com/OndrejM/getting-started-microprofile/blob/master/src/main/java/ws/ament/microprofile/gettingstarted/AuthorService.java#L20 AFAIK, the only way to specify the URL for the client proxy is to provide it under a generated MP config name, such as |
I can use this as well to allow the mapping of the newly introduced mp.jwt.* config names in the MP-JWT spec to previously defined names that were part of the wfswarm implementation. For example: @Dependent
public class JWTAuthContextInfoProvider {
private static final String NONE = "NONE";
@Inject
@ConfigProperty(name = "mpjwt.signerPublicKey", defaultValue = NONE, alias = "mp.jwt.verify.publickey")
private Optional<String> publicKeyPemEnc;
@Inject
@ConfigProperty(name = "mpjwt.issuedBy", defaultValue = NONE, alias = "mp.jwt.issuer")
private String issuedBy;
@Inject
@ConfigProperty(name = "mpjwt.expGracePeriodSecs", defaultValue = "60")
private Optional<Integer> expGracePeriodSecs;
@Inject
@ConfigProperty(name = "mpjwt.jwksUri", defaultValue = NONE, alias = "mp.jwt.verify.publickey.location")
private Optional<String> jwksUri;
@Inject
@ConfigProperty(name = "mpjwt.jwksRefreshInterval", defaultValue = "60")
private Optional<Integer> jwksRefreshInterval; Here I have added the MP-JWT spec defined mp.jwt.verify.publickey, mp.jwt.issuer, and mp.jwt.verify.publickey.location as aliases to the pre-existing vendor specific config names. |
Reviewing this issue again, I've changed my mind. Instead of supporting property mappings, I think it's better if each specification provides means how to simplify the required property name. In the case of REST client, this is already done in version 1.3 with @RegisterRestClient.configKey. General property mapping, which would be needed @starksm64 is useful only for specific usecases and should be instead optionally provided by implementations or a custom config source. I'm closing this issue. |
Allow users to specify an alias for configuration names to map generated configuration names to simpler names.
This is helpful especially to simplify configuration for names generated e.g. by fault tolerance or rest client annotations. These generate a very long and complicated config name and for some sources if also contains illegal characters. This is addressed already by #326. But it doesn't make it easier to work with only possible to use them with those config sources.
I think aliases would be also useful when defining a configuration contract and documentation for the application. It's much easier to work with user-defined configuration names than with generated names, while generated names are used as a fallback if not defined by a user.
The text was updated successfully, but these errors were encountered: