Skip to main content

Python wrapper for Cloud Foundry environments

Project description

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 me@example.com...
OK

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cfenv, version 0.5.3
Filename, size File type Python version Upload date Hashes
Filename, size cfenv-0.5.3-py2.py3-none-any.whl (4.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size cfenv-0.5.3.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page