Python wrapper for Cloud Foundry environments
Project description
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.
Source Distribution
cfenv-0.5.3.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for cfenv-0.5.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7815bffcc4a3db350f92517157fafc577c11b5a7ff172dc5632f1042b93073e8 |
|
MD5 | 15eea7f86af3e3aef1e9e8a611839841 |
|
BLAKE2-256 | 15b05fc4d8dc9fd0807b240cab217c26bb8a37ca22e8f86d0b0e896e6fc16655 |