mirror of
https://github.com/weloe/token-go.git
synced 2025-10-05 15:36:50 +08:00
feat: add viper to implement read yaml,ini config
This commit is contained in:
@@ -3,11 +3,23 @@ package config
|
||||
import "testing"
|
||||
|
||||
func TestNewConfig(t *testing.T) {
|
||||
config, err := NewConfig("")
|
||||
config, err := NewConfig("../examples/token_conf.yaml")
|
||||
if err != nil {
|
||||
t.Fatalf("read error: %v", err)
|
||||
t.Errorf("read error: %v", err)
|
||||
}
|
||||
t.Log(config)
|
||||
tokenConfig := config.(*FileConfig).TokenConfig
|
||||
|
||||
t.Log(tokenConfig)
|
||||
}
|
||||
|
||||
func TestNewIniConfig(t *testing.T) {
|
||||
config, err := NewConfig("../examples/token_conf.ini")
|
||||
if err != nil {
|
||||
t.Errorf("read error: %v", err)
|
||||
}
|
||||
tokenConfig := config.(*FileConfig).TokenConfig
|
||||
|
||||
t.Log(tokenConfig)
|
||||
}
|
||||
|
||||
func TestDefaultCookieConfig(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user