MCPcopy
hub / github.com/cloudflare/cloudflared / readAuthURL

Function readAuthURL

token/token.go:170–176  ·  view source on GitHub ↗

readAuthURL reads the auth URL companion file for the given token path. Returns the URL string, or empty string if the file doesn't exist or can't be read.

(tokenPath string)

Source from the content-addressed store, hash-verified

168// Returns the URL string, or empty string if the file doesn't exist or
169// can't be read.
170func readAuthURL(tokenPath string) string {
171 data, err := os.ReadFile(tokenPath + ".url") // nolint: gosec
172 if err != nil {
173 return ""
174 }
175 return strings.TrimSpace(string(data))
176}
177
178// tryCreateLockFile atomically creates the lock file using O_CREATE|O_EXCL
179// and writes the current process's PID and start time into it as JSON.

Callers 3

TestReadAuthURL_ExistsFunction · 0.85
acquireLockFileFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestReadAuthURL_ExistsFunction · 0.68