I have a micronaut app with application.yaml having this configuration:
confluent:
name: Consumer Events Registry
base_url: abcd-xyz.westus2.azure.confluent.cloud
secrets:
access_key: ${CONFLUENT_KEY}
secret: ${CONFLUENT_SECRET}
I have set CONFLUENT_SECRET and CONFLUENT_SECRET as env variables (through .bashrc) and I'm using the following ConfigurationProperties class to parse it:
@Getter
@Setter
@ConfigurationProperties("confluent")
public class ConfluentRegistryConfig {
private String name;
private String baseUrl;
private SecretsConfig secrets;
@Getter
@Setter
public static class SecretsConfig {
@JsonProperty("access_key") private String accessKey;
@JsonProperty("secret") private String secret;
}
}
It reads the name
and baseUrl
properly but for access_key and secret it reads the "${CONFLUENT_KEY}" and "${CONFLUENT_SECRET}" strings as value. I was hoping that ConfigurationProperties could resolve these env variables but it does not appear to do so.
I also tried using them like {env. CONFLUENT_KEY}
, {{env.CONFLUENT_KEY}}
and ${env. CONFLUENT_KEY}
but it reads them as string and does not resolve them.