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.

Source Distribution

cfenv-0.5.3.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

cfenv-0.5.3-py2.py3-none-any.whl (4.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cfenv-0.5.3.tar.gz.

File metadata

  • Download URL: cfenv-0.5.3.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cfenv-0.5.3.tar.gz
Algorithm Hash digest
SHA256 c7a91a4c82431acfc35db664c194d5e6cc7f4df3dcb692d0f836a6ceb0156167
MD5 41d161bcfb5fb8536cf099d0bacb58da
BLAKE2b-256 8af56682c335d19d116b0c076392884784216eb22e5ebe81a9c6ce4aa3ce9027

See more details on using hashes here.

File details

Details for the file cfenv-0.5.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for cfenv-0.5.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7815bffcc4a3db350f92517157fafc577c11b5a7ff172dc5632f1042b93073e8
MD5 15eea7f86af3e3aef1e9e8a611839841
BLAKE2b-256 15b05fc4d8dc9fd0807b240cab217c26bb8a37ca22e8f86d0b0e896e6fc16655

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page