.github,cmd/cigocacher: read access token from env

Change-Id: Ic705fe496ae0616126f83d9a00a73ec9e6105cec
Signed-off-by: Tom Proctor <[email protected]>
This commit is contained in:
Tom Proctor committed 2026-01-28 19:48:28 +00:00
1 parent aca1b5da0f
commit f70bf26656
2 files changed
+7 -2

No files matched your search

+2 -1
View File
@@ -49,6 +49,7 @@ fi
echo "Fetched cigocacher token successfully"
echo "::add-mask::${CIGOCACHER_TOKEN}"
echo "CIGOCACHER_TOKEN=${CIGOCACHER_TOKEN}" >> "${GITHUB_ENV}"
echo "GOCACHEPROG=${BIN_PATH} --cache-dir ${CACHE_DIR} --cigocached-url ${URL} --cigocached-host ${HOST} --token ${CIGOCACHER_TOKEN}" >> "${GITHUB_ENV}"
echo "GOCACHEPROG=${BIN_PATH} --cache-dir ${CACHE_DIR} --cigocached-url ${URL} --cigocached-host ${HOST}" >> "${GITHUB_ENV}"
echo "success=true" >> "${GITHUB_OUTPUT}"
+5 -1
View File
@@ -40,13 +40,17 @@ func main() {
version = flag.Bool("version", false, "print version and exit")
auth = flag.Bool("auth", false, "auth with cigocached and exit, printing the access token as output")
stats = flag.Bool("stats", false, "fetch and print cigocached stats and exit")
token = flag.String("token", "", "the cigocached access token to use, as created using --auth")
token = flag.String("token", "", "the cigocached access token to use, as created using --auth; defaults to CIGOCACHER_TOKEN env var if set")
srvURL = flag.String("cigocached-url", "", "optional cigocached URL (scheme, host, and port). Empty means to not use one.")
srvHostDial = flag.String("cigocached-host", "", "optional cigocached host to dial instead of the host in the provided --cigocached-url. Useful for public TLS certs on private addresses.")
dir = flag.String("cache-dir", "", "cache directory; empty means automatic")
verbose = flag.Bool("verbose", false, "enable verbose logging")
)
flag.Parse()
// Default --token _after_ parsing flags so we don't print it in --help output.
if *token == "" {
*token = os.Getenv("CIGOCACHER_TOKEN")
}
if *version {
info, ok := debug.ReadBuildInfo()