I try to pass Docker env variable in my Spring boot application.yml like this:
security:
saml2:
relyingparty:
registration:
my-saml:
signing:
credentials:
- private-key-location: classpath:HARD_PATH_TO_KEY
certificate-location: classpath:HARD_PATH_TO_CERT
identityprovider:
verification.credentials:
- certificate-location: classpath:HARD_PATH_TO_CERT
entity-id: MY_ID
singlesignon:
url: {{saml.ip.singlesignon.url}}
sign-request: true
But when I use env variable to
- private-key-location: {{saml.ip.private.key}}
certificate-location: {{saml.ip.certif.emp}}
and
verification.credentials:
- certificate-location: {{saml.ip.certif2.emp}}
I got this error:
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to java.lang.String
at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
at org.springframework.beans.factory.config.YamlProcessor.buildFlattenedMap(YamlProcessor.java:309)
at org.springframework.beans.factory.config.YamlProcessor.lambda$buildFlattenedMap$1(YamlProcessor.java:325)
at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
at org.springframework.beans.factory.config.YamlProcessor.buildFlattenedMap(YamlProcessor.java:309)
at org.springframework.beans.factory.config.YamlProcessor.lambda$buildFlattenedMap$1(YamlProcessor.java:325)
at java.util.Collections$SingletonMap.forEach(Collections.java:4910)
Any idea
2
Answers
Try to remove the ‘-‘ at the beginning of lines
If you want 2 separate Strings, or
credentials
is a Map, I think it should be:If you want an array, I think it should be: