.NET Components for Externalized Configuration, Database Connectors, Service Discovery, Logging and Distributed Tracing, Application Management, Security, and more.
When binding to scalar values, keys with . in them do not need to be surrounded by []. Scalar values include enums and all types in the java.lang package except for Object. Binding a.b=c to Map<String, String> will preserve the . in the key and return a Map with the entry {"a.b"="c"}. For any other types you need to use the bracket notation if your key contains a .. For example, binding a.b=c to Map<String, Object> will return a Map with the entry {"a"={"b"="c"}} whereas [a.b]=c will return a Map with the entry {"a.b"="c"}.
Based on that, Steeltoe should translate the Spring configuration key a.b.c to a:b:c (which it already does). But also translate [a.b].c to a.b:c, which is currently not the case. And translate arrays, such as a[0].b to a:0:b (which it already does).
This affects the various Steeltoe configuration providers, such as Placeholder, SpringBoot, and Config Server. Key translation isn't correct everywhere and there's limited test coverage.
Describe the bug
As described at https://docs.spring.io/spring-boot/reference/features/external-config.html#features.external-config.yaml.mapping-to-properties, Spring Boot supports escaping dots in configuration keys:
Based on that, Steeltoe should translate the Spring configuration key
a.b.c
toa:b:c
(which it already does). But also translate[a.b].c
toa.b:c
, which is currently not the case. And translate arrays, such asa[0].b
toa:0:b
(which it already does).Because there's no way to escape colons in .NET configuration keys, there's nothing Steeltoe can do to properly translate when the Spring key contains a colon.
This affects the various Steeltoe configuration providers, such as Placeholder, SpringBoot, and Config Server. Key translation isn't correct everywhere and there's limited test coverage.