MCPcopy Create free account
hub / github.com/opencloud-eu/opencloud / ParseConfig

Function ParseConfig

services/postprocessing/pkg/config/parser/parse.go:17–36  ·  view source on GitHub ↗

ParseConfig loads configuration from known paths.

(cfg *config.Config)

Source from the content-addressed store, hash-verified

15
16// ParseConfig loads configuration from known paths.
17func ParseConfig(cfg *config.Config) error {
18 err := occfg.BindSourcesToStructs(cfg.Service.Name, cfg)
19 if err != nil {
20 return err
21 }
22
23 defaults.EnsureDefaults(cfg)
24
25 // load all env variables relevant to the config in the current context.
26 if err := envdecode.Decode(cfg); err != nil {
27 // no environment variable set for this config is an expected "error"
28 if !errors.Is(err, envdecode.ErrNoTargetFieldsAreSet) {
29 return err
30 }
31 }
32
33 defaults.Sanitize(cfg)
34
35 return Validate(cfg)
36}
37
38// Validate validates the config
39func Validate(cfg *config.Config) error {

Callers 2

ServerFunction · 0.92
RestartPostprocessingFunction · 0.92

Calls 4

EnsureDefaultsFunction · 0.92
DecodeFunction · 0.92
SanitizeFunction · 0.92
ValidateFunction · 0.70

Tested by

no test coverage detected