I have created an spring integration application and hosted that in PCF (Pivotal Cloud Foundry) environment.
Let us say my manifest file is as follows:
applications:
- name: test
memory: 1024M
instances: 1
domain: cfapps.pcf1.vc1.pcf.abc.com
path: target/test-0.1.0.jar
health-check-type: http
health-check-http-endpoint: /health
env:
SPRING_LOG_LEVEL:INFO
param1: value1
param2: value2
param3: value3
And my application.yml file is as follows:
# default properties
logging:
level:
org.springframework.integration: $SPRING_LOG_LEVEL
endpoints:
autoconfig.sensitive: false
configprops.sensitive: false
env.sensitive: false
loggers.sensitive: false
mq:
queues:
validation: queue1
authorization: queue2
channel: channel1
hostName: host1
port: 100
queueManager: QMGR
transportType: 1
max-concurrent-consumers: $param1
concurrent-consumers: $param2
max-messages-per-task: $param3
idle-consumer-limit: 1
idle-task-execution-limit: 1
My question is how do I access the PCF environment values such as SPRING_LOG_LEVEL, param1, param2 and param3 values present in MANIFEST .yml file inside application .yml or inside spring integration xml file.
Please let me know, if you need further details. Please excuse me if something is not clear as I am new to PCF.
Those environment variables in your manifest are truly environment variables to the container your boot app is running in and can be accessed as such, either via System.getenv
or the SpEL ${VARIABLE}
format.