Browse Source

Fix config parsing

pull/31/head
Jonas Franz 6 months ago
parent
commit
ca9a16558e
2 changed files with 13 additions and 2 deletions
  1. 2
    2
      config/config.go
  2. 11
    0
      config/config_test.go

+ 2
- 2
config/config.go View File

@@ -5,9 +5,9 @@ var Config = struct {
5 5
 	GitHub struct {
6 6
 		ClientID     string `required:"true" yaml:"client_id"`
7 7
 		ClientSecret string `required:"true" yaml:"client_secret"`
8
-	}
8
+	} `yaml:"GitHub"`
9 9
 	Web struct {
10 10
 		Host string `yaml:"host"`
11 11
 		Port int    `yaml:"port"`
12
-	}
12
+	} `yaml:"Web"`
13 13
 }{}

+ 11
- 0
config/config_test.go View File

@@ -0,0 +1,11 @@
1
+package config
2
+
3
+import (
4
+	"github.com/jinzhu/configor"
5
+	"github.com/stretchr/testify/assert"
6
+	"testing"
7
+)
8
+
9
+func TestReadConfig(t *testing.T) {
10
+	assert.NoError(t, configor.New(&configor.Config{ErrorOnUnmatchedKeys: true}).Load(&Config, "../config.example.yml"), "Parse example config failed.")
11
+}

Loading…
Cancel
Save