Ravi Vyas
Ravi Vyas

Reputation: 510

How can i view environment variables of pivotal cloud foundry app while running the app on localhost

I used to view all the environment variables(defined in application.properties) of traditional springboot app by going to http://localhost:8080/env. Now, i am running the app on pivotal cloud foundry environment and trying to hit the : http://localhost:8080/env but is not working for me for pivotal cloud foundry set up.

Note: i know how to view the environment variables from CF CLI or APP Manager. But i dont want to do it that way. I am trying to fetch them through localhost:8080 link only.

Upvotes: 1

Views: 1138

Answers (2)

Ravi Vyas
Ravi Vyas

Reputation: 510

Use Spring-Actuator to enable such functionality https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html

Upvotes: 1

Gurpreet Singh
Gurpreet Singh

Reputation: 38

One solution is to use the config server for this which basically gets the application.properties from a git repository. Please find the references here. https://docs.pivotal.io/spring-cloud-services/1-5/common/config-server/index.html

The second option will be to get it as a static file and like a js or CSS file the references for this option can be found here. https://www.baeldung.com/spring-mvc-static-resources

Upvotes: 1

Related Questions