Reputation: 21
I have a simple java web service that uses javalin framework. I want to deploy it in multiple environments, so the env variables are different for each deployment.
I basically want to read
application-env.yml
keystore:
path: ${KEY_STORE_PATH}
password: ${KEY_STORE_PASSWORD}
from application-env.yml without using Spring.
And then use them in java.
Properties properties = PropertiesLoader.loadProperties();
System.out.println(properties.getProperty("keystore.password"));
// ${KEY_STORE_PASSWORD}
System.out.println(System.getenv("KEY_STORE_PASSWORD"));
// hunter2
How do I get hunter2 from properties?
EDIT:
i didnt get what I wanted, ended up doing this: https://stackoverflow.com/a/73539823/2948875
Upvotes: 0
Views: 1208
Reputation: 75
You could use something like SnakeYAML, ie https://www.baeldung.com/java-snake-yaml
Upvotes: 1