cloudfoundry-community / go-cfenv

Go Cloud Foundry Environment Parsing Package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go CF Environment Package Build Status - Master

Overview

GoDoc

cfenv is a package to assist you in writing Go apps that run on Cloud Foundry. It provides convenience functions and structures that map to Cloud Foundry environment variable primitives (http://docs.cloudfoundry.org/devguide/deploy-apps/environment-variable.html).

Usage

go get github.com/cloudfoundry-community/go-cfenv

package main

import (
	"github.com/cloudfoundry-community/go-cfenv"
)

func main() {
	appEnv, _ := cfenv.Current()

	fmt.Println("ID:", appEnv.ID)
	fmt.Println("Index:", appEnv.Index)
	fmt.Println("Name:", appEnv.Name)
	fmt.Println("Host:", appEnv.Host)
	fmt.Println("Port:", appEnv.Port)
	fmt.Println("Version:", appEnv.Version)
	fmt.Println("Home:", appEnv.Home)
	fmt.Println("MemoryLimit:", appEnv.MemoryLimit)
	fmt.Println("WorkingDir:", appEnv.WorkingDir)
	fmt.Println("TempDir:", appEnv.TempDir)
	fmt.Println("User:", appEnv.User)
	fmt.Println("Services:", appEnv.Services)
}

Contributing

Pull requests welcomed.

About

Go Cloud Foundry Environment Parsing Package

License:Apache License 2.0


Languages

Language:Go 100.0%