Skip to content
forked from jmcarp/py-cfenv

Python wrapper for Cloud Foundry environments

License

Notifications You must be signed in to change notification settings

asherbar/py-cfenv

 
 

Repository files navigation

py-cfenv

Latest version Travis-CI

py-cfenv is a tiny utility that simplifies interactions with Cloud Foundry environment variables, modeled after node-cfenv.

Quickstart

from cfenv import AppEnv

env = AppEnv()
env.name  # 'test-app'
env.port  # 5000

redis = env.get_service(label='redis')
redis.credentials  # {'uri': '...', 'password': '...'}
redis.get_url(host='hostname', password='password', port='port')  # redis://pass:host

Keys may change based on the service. To see what keys are available for the app's services:

$ cf env my-app

Getting env variables for app my-app in org my-org / space my-space as [email protected]...
OK

System-Provided:
{
 "VCAP_SERVICES": {
  "redis": [
   {
    "credentials": {
     "hostname": "example.redis.host",
     "password": "verysecurepassword",
     "port": "30773",
     "ports": {
      "6379/tcp": "30773"
     },
     "uri": "redis://:[email protected]:30773"
    },
    "label": "redis",
    "name": "example-redis",
    "plan": "standard",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "redis28",
     "redis"
    ],
    "volume_mounts": []
   }
  ]
 }
}

About

Python wrapper for Cloud Foundry environments

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%