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


Release history Release notifications

This version
History Node

0.5.3

History Node

0.5.2

History Node

0.5.1

History Node

0.5.0

History Node

0.4.0

History Node

0.3.0

History Node

0.2.0

History Node

0.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
cfenv-0.5.3-py2.py3-none-any.whl (4.5 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Jun 9, 2017
cfenv-0.5.3.tar.gz (3.2 kB) Copy SHA256 hash SHA256 Source None Jun 9, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page