MCPcopy Create free account
hub / github.com/PostHog/duckgres / LoadFile

Function LoadFile

configloader/load.go:13–23  ·  view source on GitHub ↗

LoadFile reads a duckgres.yaml file from disk and parses it. Returns the caller-friendly error from os.ReadFile (so a missing file is recognizable via os.IsNotExist) or a wrapped yaml-parsing error.

(path string)

Source from the content-addressed store, hash-verified

11// caller-friendly error from os.ReadFile (so a missing file is recognizable
12// via os.IsNotExist) or a wrapped yaml-parsing error.
13func LoadFile(path string) (*FileConfig, error) {
14 data, err := os.ReadFile(path)
15 if err != nil {
16 return nil, err
17 }
18 var cfg FileConfig
19 if err := yaml.Unmarshal(data, &cfg); err != nil {
20 return nil, fmt.Errorf("failed to parse config file: %w", err)
21 }
22 return &cfg, nil
23}
24
25// Env returns the value of the named environment variable, falling back to
26// defaultVal when unset or empty. Shared by every duckgres binary so the

Callers 2

mainFunction · 0.92
mainFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected