github.com/govau/cf-common@v0.0.7/env/ups_example_test.go (about) 1 package env_test 2 3 import ( 4 "fmt" 5 6 "github.com/cloudfoundry-community/go-cfenv" 7 "github.com/govau/cf-common/env" 8 ) 9 10 func ExampleWithUPSLookup() { 11 app, err := cfenv.Current() 12 if err != nil { 13 // ... 14 } 15 16 opts := []env.VarSetOpt{ 17 env.WithOSLookup(), // Always look in the OS env first. 18 env.WithUPSLookup(app, "service-1"), 19 } 20 21 vs := env.NewVarSet(opts...) 22 23 v := vs.MustString("FOO") 24 25 fmt.Println(v) 26 }