MCPcopy Create free account
hub / github.com/cloudfoundry/credhub-cli / init

Function init

commands/token.go:12–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10)
11
12func init() {
13 CredHub.Token = func() {
14 cfg := config.ReadConfig()
15
16 if util.TokenIsPresent(cfg.AccessToken) {
17 cfg = refreshConfiguration(cfg)
18 config.WriteConfig(cfg)
19 fmt.Println("Bearer " + cfg.AccessToken)
20 } else if os.Getenv("CREDHUB_CLIENT") != "" && os.Getenv("CREDHUB_SECRET") != "" {
21 cfg = refreshConfiguration(cfg)
22 fmt.Println("Bearer " + cfg.AccessToken)
23 } else {
24 fmt.Fprint(os.Stderr, "You are not currently authenticated. Please log in to continue.")
25 }
26 os.Exit(0)
27 }
28}
29
30func refreshConfiguration(cfg config.Config) config.Config {
31 credhubClient, _ := initializeCredhubClient(cfg)

Callers

nothing calls this directly

Calls 4

ReadConfigFunction · 0.92
TokenIsPresentFunction · 0.92
WriteConfigFunction · 0.92
refreshConfigurationFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…