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] [[serve.weight]] projectname = 3 projectcode = 1 budget = 2 bidamount = 2 buyer = 3 buyerclass = 1 buyerperson = 1 buyertel = 1 agency = 3 agencyperson = 1 agencytel = 1 toptype = 1 subtype = 1 topscopeclass = 1 subscopeclass = 1 s_winner = 3 bidopentime = 1 contractcode = 3 qualifies = 1 attachments = 2 package = 1 purchasinglist = 1 winerorder = 1 [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" [udp] locport = ":1787" [[udp.next]] addr = "127.0.0.1" port = 1783 stype = "bidding" remark = "索引" [[udp.next]] addr = "127.0.0.1" port = 1782 stype = "" remark = "" [[udp.next]] addr = "127.0.0.1" port = 1680 stype = "subject" remark = "医疗数据" [[udp.next]] addr = "127.0.0.1" port = 1681 stype = "" remark = "" [[udp.next]] addr = "127.0.0.1" port = 1970 stype = "" remark = "" ` func TestInit(t *testing.T) { testfile := "/tmp/crocodile.toml" ioutil.WriteFile(testfile, []byte(confs), 0644) Init(testfile) t.Logf("%+v", Conf.DB.Mongo.Addr) os.Remove(testfile) }