package config import ( "io/ioutil" "os" "testing" ) var confs = `# log [log] logpath = "" maxsize = 10 compress = true maxage = 7 maxbackups = 10 loglevel = "info" format = "text" [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.mysql] addr = "192.168.3.217:4000" dbnameBasic = "global_common_data" dbnameMedical = "medical_fileld_data" size = 5 user = "root" password = "=PDT49#80Z!RVv52_z" [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" [db.es.fieldarrm] id = "int" company_id = "string" mi_name = "string" alias = "string" area_code = "string" level_code = "string" mi_type_code = "string" business_type = "int" sdequipment = "string" ` func TestInit(t *testing.T) { testfile := "/tmp/crocodile.toml" ioutil.WriteFile(testfile, []byte(confs), 0644) Init(testfile) t.Logf("%+v", Conf.DB) os.Remove(testfile) }