From 94e19200985aae2fe17126f35374f91ade2399bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Wed, 19 Jan 2022 00:39:49 +0100 Subject: [PATCH] Improve config --- config.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/config.go b/config.go index ac7ee78..2992bfa 100644 --- a/config.go +++ b/config.go @@ -22,15 +22,13 @@ type ServerStoreConfig struct { func ServerConfigFromReader(r io.Reader) (*ServerConfig, error) { decoder := toml.NewDecoder(r) - var c ServerConfig + c := ServerConfig{ + Store: &ServerStoreConfig{}, + } if err := decoder.Decode(&c); err != nil { return nil, fmt.Errorf("error decoding server config: %w", err) } - if c.Store == nil { - c.Store = &ServerStoreConfig{} - } - c.updateFromEnv() return &c, nil