From ca9a16558e4b429dc23d51b8f48b86b9f66c810d Mon Sep 17 00:00:00 2001 From: Jonas Franz Date: Mon, 17 Dec 2018 12:47:47 +0100 Subject: [PATCH] Fix config parsing --- config/config.go | 4 ++-- config/config_test.go | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 config/config_test.go diff --git a/config/config.go b/config/config.go index 9893b22..ce1aaaa 100644 --- a/config/config.go +++ b/config/config.go @@ -5,9 +5,9 @@ var Config = struct { GitHub struct { ClientID string `required:"true" yaml:"client_id"` ClientSecret string `required:"true" yaml:"client_secret"` - } + } `yaml:"GitHub"` Web struct { Host string `yaml:"host"` Port int `yaml:"port"` - } + } `yaml:"Web"` }{} diff --git a/config/config_test.go b/config/config_test.go new file mode 100644 index 0000000..f33de37 --- /dev/null +++ b/config/config_test.go @@ -0,0 +1,11 @@ +package config + +import ( + "github.com/jinzhu/configor" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestReadConfig(t *testing.T) { + assert.NoError(t, configor.New(&configor.Config{ErrorOnUnmatchedKeys: true}).Load(&Config, "../config.example.yml"), "Parse example config failed.") +}