MCPcopy Create free account
hub / github.com/GoogleChrome/webstatus.dev / parseEnvVarDuration

Function parseEnvVarDuration

backend/cmd/server/main.go:45–54  ·  view source on GitHub ↗
(key string)

Source from the content-addressed store, hash-verified

43 "github.com/GoogleChrome/webstatus.dev/lib/valkeycache"
44 "github.com/go-chi/cors"
45)
46
47func parseEnvVarDuration(key string) time.Duration {
48 cacheDuration := os.Getenv(key)
49 duration, err := time.ParseDuration(cacheDuration)
50 if err != nil {
51 slog.ErrorContext(context.TODO(), "unable to parse duration", "key", key, "input value", cacheDuration)
52 os.Exit(1)
53 }
54
55 return duration
56}
57

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected