diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-07 15:58:04 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-07 15:58:04 -0700 |
| commit | 041c2df698d4702816cf8472d212553d289a2c0c (patch) | |
| tree | 4b461b916462bbf0909c50081aa899373e0aaffb /hotline/server.go | |
| parent | 7c7c1f63412ead526ff7bf9e029591c50aefabf7 (diff) | |
Add initial validations of config.yaml
Diffstat (limited to 'hotline/server.go')
| -rw-r--r-- | hotline/server.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/hotline/server.go b/hotline/server.go index fb06001..e6322e0 100644 --- a/hotline/server.go +++ b/hotline/server.go @@ -5,6 +5,7 @@ import ( "encoding/binary" "errors" "fmt" + "github.com/go-playground/validator/v10" "go.uber.org/zap" "io" "io/fs" @@ -477,6 +478,12 @@ func (s *Server) loadConfig(path string) error { if err != nil { return err } + + validate := validator.New() + err = validate.Struct(s.Config) + if err != nil { + return err + } return nil } |