I use PKL for most of my configuration needs these days. But PKL is only a format, it doesn't say where to store the config. Could I use Externalized Properties to e.g. fetch config from some random source but have it be PKL?
public class PklResolver implements Resolver {
public Optional<String> resolve(InvocationContext context, String propertyName) {
return getFromPklConfig(propertyName);
}
}
// Register custom resolver when building ExternalizedProperties
ExternalizedProperties externalizedProperties = ExternalizedProperties.builder()
.resolvers(new PklResolver(...))
.build();
AppProperties appProperties = externalizedProperties.initialize(AppProperties.class);
// Resolves config from PklResolver
String myConfig = appProperties.myConfig();