internal: dont error if environment config isn't found

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-12-09 13:34:20 +00:00
parent 5ae593bc00
commit b6b72e389d
1 changed files with 4 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package config package config
import ( import (
"errors"
"fmt" "fmt"
"net/url" "net/url"
"os" "os"
@ -62,6 +63,9 @@ func (c *Config) Setup(paths ...string) {
func (c *Config) LoadConfig(path string) error { func (c *Config) LoadConfig(path string) error {
raw, err := os.ReadFile(path) raw, err := os.ReadFile(path)
if err != nil { if err != nil {
if errors.Is(err, os.ErrNotExist) {
return nil
}
return fmt.Errorf("failed to load config file: %w", err) return fmt.Errorf("failed to load config file: %w", err)
} }
err = yaml.Unmarshal(raw, c) err = yaml.Unmarshal(raw, c)