Run Time Argumnets in PCF

127 views Asked by At

In order to run the application in my local, i need to provide some VM arguments(basically file path, where it is located). In similar way in PCF also I have to provide those arguments.

currently I am keeping in application.yml file like below.

    jaas: 
      conf: /home/vcap/app/BOOT-INF/classes/nonprod_jaas.conf

    krb5: 
      conf: /home/vcap/app/BOOT-INF/classes/krb5.conf

    trustore: 
      conf: /home/vcap/app/BOOT-INF/classes/kafka_client_truststore.jks   

When I deploy the application in PCF, will these files will be read from that location.

Basically I want to know this is correct way or not to provide the arguments in PCF.

how to check whether the file is present in that location, /home/vcap/app/BOOT-INF/classes/

1

There are 1 answers

0
arjain13 On

You need to ssh into the container to check the location of the file.

cf ssh appname

In spring, @Value enables the use of the classpath: prefix to resolve the classpath (see this link) https://www.baeldung.com/spring-classpath-file-accessclasspath: It means you need to set this programmatically not via the variables in yml. Then you don't need to provide the path the way you are doing.

Also classpath: is a Spring specific convention, the JVM doesn't understand it which means you cannot use it directly in application.yml file. If you need to set in yml or as environment variable - you need to give it a full or relative path. On PCF, you can use /app or /home/vcap/app (the former is a symlink to the latter) as the path to the root of your application.