Browse Source

Fix config parsing

pull/31/head
Jonas Franz 1 year 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 {
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"`
}{}

+ 11
- 0
config/config_test.go View File

@@ -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.")
}

Loading…
Cancel
Save