package config

import (
	"io/ioutil"
	"os"
	"testing"
)

var confs = `# log
[log]
logpath = ""
maxsize = 10
compress = true
maxage =  7
maxbackups = 10
loglevel  = "info"
format = "text"

[serve]
grpcAddr = "192.168.3.12:10021"
udpPort = "1782"

[db]
[db.mongo]
addr = "192.168.3.207:27092"
dbname = "qfw"
size = 10
user = ""
password = ""
[db.mongo1]
addr = "192.168.3.207:27092"
dbname = "wjh"
size = 5
user = ""
password = ""

[db.es]
addr = "http://192.168.3.206:9800"
size = 5
indexm = "medical_institution_v1"
typem = "medical_institution"
indexs = "supplier_product_v1"
types = "supplier_product"

`

func TestInit(t *testing.T) {
	testfile := "/tmp/crocodile.toml"
	ioutil.WriteFile(testfile, []byte(confs), 0644)
	Init(testfile)
	t.Logf("%+v", Conf.Serve.GrpcAddr)
	os.Remove(testfile)
}
