In my application.yaml properties file I have a variable defined as below -
service-account:
# secret: //commented in the yaml file, to indicate that it's used in app but read from ENV variable.
From this SOF post, I understand how . (dots) and - (dashes) are converted.
Now in the ENV variables file - I don't have anything like -
service-account.secret or service-account_secret or service_account_secret etc
instead what i have in the env (file) is - SERVICEACCOUNT_SECRET=xyz
Does spring boot match variable service-account.secret in props file with SERVICEACCOUNT_SECRET env variable.
Can someone confirm.
Yes. The canonical form of a property is all lower-case with
-and.separators.service-account.secretis in the canonical form. To convert from the canonical form to an environment variable, Spring Boot does the following:Following these steps,
service-account.secretbecomesSERVICEACCOUNT_SECRETso you can use theSERVICEACCOUNT_SECRETenvironment variable to set theservice-account.secretproperty.