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": []
}
]
}
}
Metadata
Release files for cfenv 0.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cfenv-0.5.3.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cfenv-0.5.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 7.8 kB
Release files / cfenv-0.5.3.tar.gz
| Download URL | cfenv-0.5.3.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7a91a4c82431acfc35db664c194d5e6cc7f4df3dcb692d0f836a6ceb0156167
|
|
BLAKE2b-256 checksum How to use checksums |
8af56682c335d19d116b0c076392884784216eb22e5ebe81a9c6ce4aa3ce9027
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / cfenv-0.5.3-py2.py3-none-any.whl
| Download URL | cfenv-0.5.3-py2.py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7815bffcc4a3db350f92517157fafc577c11b5a7ff172dc5632f1042b93073e8
|
|
BLAKE2b-256 checksum How to use checksums |
15b05fc4d8dc9fd0807b240cab217c26bb8a37ca22e8f86d0b0e896e6fc16655
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |