LoadFrom loads config from file.
(file string)
| 33 | |
| 34 | // LoadFrom loads config from file. |
| 35 | func LoadFrom(file string) (config.Config, error) { |
| 36 | var c config.Config |
| 37 | b, err := os.ReadFile(file) |
| 38 | if err != nil { |
| 39 | return c, fmt.Errorf("could not load config from file: %w", err) |
| 40 | } |
| 41 | |
| 42 | err = yaml.Unmarshal(b, &c) |
| 43 | if err != nil { |
| 44 | return c, fmt.Errorf("could not load config from file: %w", err) |
| 45 | } |
| 46 | |
| 47 | return c, nil |
| 48 | } |
| 49 | |
| 50 | // ValidateConfig validates config before we use it |
| 51 | func ValidateConfig(c config.Config) error { |
no outgoing calls
no test coverage detected