I want to deploy my angular 6 app on PCF as a stand alone app using nodejs buildpack. Is there a way to do that without adding the angular universal feature to it.
If it is not possible, is there a way to read PCF user provided environment variables if I deploy my app using static buildpack?
All output sent to STDOUT is relayed to the user through the Cloud Foundry Command Line Interface (cf CLI). The script is run with four arguments: The build directory for the app. The cache directory, which is a location the buildpack can use to store assets during the build process.
It is possible to use nginx_buildpack adding an url to nginx configuration to give access to cloudfoundry environnement variables.
Using nginx.conf in the root folder of your application :
http {
server {
listen {{port}};
root public;
location /myenv {
return 200 '{{ env "MYENV" }}';
}
}
}
events {}
Pushing the application using :
cf push <myapp> -b https://github.com/cloudfoundry/nginx-buildpack.git --no-start
cf set-env <myapp> MYENV "whatever you like"
cf start <myapp>
Then you can access from the angular application to the environment variable using /myenv
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With