MCPcopy Index your code
hub / github.com/go-task/task / getConfig

Function getConfig

internal/flags/flags.go:318–330  ·  view source on GitHub ↗

getConfig extracts a config value with priority: env var > taskrc config > fallback

(config *taskrcast.TaskRC, envKey string, fieldFunc func() *T, fallback T)

Source from the content-addressed store, hash-verified

316
317// getConfig extracts a config value with priority: env var > taskrc config > fallback
318func getConfig[T any](config *taskrcast.TaskRC, envKey string, fieldFunc func() *T, fallback T) T {
319 if envKey != "" {
320 if val, ok := getEnvAs[T](envKey); ok {
321 return val
322 }
323 }
324 if config != nil {
325 if field := fieldFunc(); field != nil {
326 return *field
327 }
328 }
329 return fallback
330}
331
332// getEnvAs parses a TASK_ prefixed env var as type T
333func getEnvAs[T any](envKey string) (T, bool) {

Callers 1

initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…