23 lines
308 B
Go
23 lines
308 B
Go
package config
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestLoadConfig(t *testing.T) {
|
|
os.Chdir("../")
|
|
wd, _ := os.Getwd()
|
|
path := filepath.Join(wd, "config.json")
|
|
|
|
err := InitConfig(path)
|
|
if nil != err {
|
|
log.Fatalln("Config error")
|
|
}
|
|
c := GetConfig()
|
|
|
|
log.Println(c.Server.Ip)
|
|
}
|