Group works on monitors
Cloud

Configure Front End Apps with Environment Variables in Cloud Foundry

Configuration from environment variables only works for apps with a dynamic backend. But what if we want to configure a front-end app?
Lena  Fuhrimann
Lena Fuhrimann, Software- and Cloud Engineer
14 marzo 2017

The 12 factor manifest tells us in point III that apps should retrieve their config from environment variables to strictly separate config from code. “Config” meaning everything that is likely to vary between deployments (staging, production, developer environments, etc). Cloud Foundry allows us to do that very easily using either the manifest.yml file or the cf set-env command. However, this only works for apps which have a dynamic back end. What if we want to configure a front end app that we have pushed to Cloud Foundry using the staticfile buildpack? These apps are, by definition, static so they cannot read out any environment variables. Therefore, if we use this buildpack to deploy an Angular or React app, we cannot use these variables.

 

To learn how to solve this problem, check out the post on my personal blog at bespinian.io.

Un articolo di:

Portrait Image

Lena Fuhrimann

Software- and Cloud Engineer

Altri articoli getIT

Pronti per Swisscom

Trova il posto di lavoro o il percorso di carriera che fa per te. Dove dare il tuo contributo e crescere professionalmente.

 

Ciò che tu fai, è ciò che siamo.