Use VCAP_APPLICATION to detect CloudFoundry environment

VCAP_SERVICES is not set on PaaS if no services are bound to the
application, so we need to check for VCAP_APPLICATION to parse the
application name and environment.
This commit is contained in:
Alexey Bezhan
2018-01-09 14:41:36 +00:00
parent 945c967250
commit 0088d588e1
2 changed files with 4 additions and 4 deletions

View File

@@ -1,8 +1,8 @@
import os
if os.environ.get('VCAP_SERVICES'):
# on cloudfoundry, config is a json blob in VCAP_SERVICES - unpack it, and populate
if os.environ.get('VCAP_APPLICATION'):
# on cloudfoundry, config is a json blob in VCAP_APPLICATION - unpack it, and populate
# standard environment variables from it
from app.cloudfoundry_config import extract_cloudfoundry_config
extract_cloudfoundry_config()