MCPcopy Index your code
hub / github.com/opencloud-eu/opencloud / ParseConfig

Function ParseConfig

services/users/pkg/config/parser/parse.go:15–34  ·  view source on GitHub ↗

ParseConfig loads configuration from known paths.

(cfg *config.Config)

Source from the content-addressed store, hash-verified

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

Callers 2

ServerFunction · 0.92
HealthFunction · 0.92

Calls 4

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

Tested by

no test coverage detected