conf_test.go 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. package config
  2. import (
  3. "io/ioutil"
  4. "os"
  5. "testing"
  6. )
  7. var confs = `
  8. [udp]
  9. locport = ":1783"
  10. jyaddr = "127.0.0.1"
  11. jyport = 11118
  12. [db]
  13. [db.mysql]
  14. addr = "192.168.3.14:4000"
  15. dbnameBasic = "global_common_data"
  16. dbnameMedical = "Jianyu_subjectdb"
  17. size = 5
  18. user = "root"
  19. password = "Tibi#20211222"
  20. maxidle = 10
  21. maxconn = 20
  22. maxquerytime = "10s"
  23. [db.mongoB]
  24. addr = "192.168.3.207:27092"
  25. dbname = "wjh"
  26. coll = "bidding"
  27. size = 15
  28. user = ""
  29. password = ""
  30. [db.mongoP]
  31. addr = "192.168.3.207:27092"
  32. dbname = "wjh"
  33. coll = "projectset"
  34. size = 15
  35. user = ""
  36. password = ""
  37. [db.mongoQ]
  38. addr = "192.168.3.207:27092"
  39. dbname = "wjh"
  40. coll = "projectset"
  41. size = 15
  42. user = ""
  43. password = ""
  44. [db.es]
  45. addr = "http://192.168.3.206:9800"
  46. size = 5
  47. indexb = "bidding"
  48. typeb = "bidding"
  49. indexp = "projectset"
  50. typep = "projectset"
  51. indexwinner = "winner"
  52. typewinner = "winner"
  53. indexbuyer = "buyer"
  54. typebuyer = "buyer"
  55. detailfilter = ["(招标网|千里马|采招网|招标采购导航网|招标与采购网|中国招投标网|中国采购与招标网|中国采购与招标|优质采)[\\w\\W]{0,15}[http|https|htpps]?[a-z0-9:\\/\\/.]{0,20}(qianlima|zhaobiao|okcis|zbytb|infobidding|bidcenter|youzhicai|chinabidding|Chinabidding|CHINABIDDING)[a-z0-9.\\/\\/]{0,40}",
  56. "招标网[\\w\\W]{0,15}[http|https|htpps]?[a-z0-9:\\/\\/.]{0,20}zhaobiao[a-z0-9.\\/\\/]{0,40}",
  57. "千里马[\\w\\W]{0,15}[a-z0-9:\\/\\/.]{0,20}qianlima[a-z0-9.\\/\\/]{0,10}",
  58. "[\\((]?(网址)?[::;;]?(http|https|htpps)*[::]?(\\/\\/)?(www|jinan|WWW)?.(zhaobiao|chinabidding|Chinabidding|CHINABIDDING|infobidding|zbytb|okcis|qianlima|youzhicai).(com|cn|COM|CN)?(.cn|.CN)?\\/?[\\))]?",
  59. "[\\((]?(网址)?(::)?(http|https|htpps)*(:|:)?\\/\\/www.bidcenter.com.cn\\/",
  60. "千里马(平台|网站)+", "[“\"]?优质采(平台|电子交易平台|云采购平台|交易平台)?[”\"]?", "《?(中国采购与|中国)?招(投)?标(与采购|采购导航)?网》?",
  61. "《?元博网(采购与招标网)?》?", "《?(中国)?招标采购导航网》?", "中\\W{0,3}国采\\W{0,3}招\\W{0,3}网\\W*[((]?(bidcenter.com.cn)?[))]?", "已方宝", "中国招标与采购"]
  62. [mail]
  63. send = false
  64. to = "wangjianghan@topnet.net.cn"
  65. api = "http://172.17.145.179:19281/_send/_mail"
  66. # 日志
  67. [log]
  68. # 日志路径,为空将输出控制台
  69. logpath = ""
  70. # log size (M)
  71. maxsize = 10
  72. # compress log
  73. compress = true
  74. # log save time (day)
  75. maxage = 7
  76. # save total log file total
  77. maxbackups = 10
  78. # log level
  79. loglevel = "debug"
  80. # text or json output
  81. format = "text"
  82. [db.es.fieldes]
  83. "_id" = ""
  84. "buyerzipcode" = "string"
  85. "winnertel" = "string"
  86. "winnerperson" = "string"
  87. "contractcode" = "string"
  88. "winneraddr" = "string"
  89. "agencyaddr" = "string"
  90. "buyeraddr" = "string"
  91. "signaturedate" = "int64"
  92. "projectperiod" = "string"
  93. "projectaddr" = "string"
  94. "agencytel" = "string"
  95. "agencyperson" = "string"
  96. "buyerperson" = "string"
  97. "agency" = "string"
  98. "projectscope" = "string"
  99. "projectcode" = "string"
  100. "bidopentime" = "int64"
  101. "supervisorrate" = "float64"
  102. "buyertel" = "string"
  103. "bidamount" = "float64"
  104. "winner" = "string"
  105. "buyer" = "string"
  106. "budget" = "float64"
  107. "projectname" = "string"
  108. "bidstatus" = "string"
  109. "buyerclass" = "string"
  110. "topscopeclass" = ""
  111. "s_topscopeclass" = "string"
  112. "s_subscopeclass" = "string"
  113. "area" = "string"
  114. "city" = "string"
  115. "district" = "string"
  116. "s_winner" = "string"
  117. "title" = "string"
  118. "detail" = "string"
  119. "site" = "string"
  120. "comeintime" = "int64"
  121. "href" = "string"
  122. "infoformat" = "int32"
  123. "publishtime" = "int64"
  124. "s_sha" = "string"
  125. "spidercode" = "string"
  126. "subtype" = "string"
  127. "toptype" = "string"
  128. "projectinfo" = ""
  129. "purchasing" = "string"
  130. "purchasinglist" = ""
  131. "channel" = "string"
  132. "winnerorder" = ""
  133. "project_scale" = "string"
  134. "project_duration" = "int32"
  135. "project_timeunit" = "string"
  136. "project_startdate" = "int64"
  137. "project_completedate" = "int64"
  138. "payway" = "string"
  139. "contract_guarantee" = "bool"
  140. "bid_guarantee" = "bool"
  141. "qualifies" = ""
  142. "entidlist" = ""
  143. "funds" = "string"
  144. "review_experts" = "string"
  145. "bidmethod" = "string"
  146. "bidendtime" = "int64"
  147. "bidopenaddress" = "string"
  148. "docamount" = "float64"
  149. "agencyrate" = "float64"
  150. "agencyfee" = "float64"
  151. "bidway" = "string"
  152. "getdocmethod" = "string"
  153. "china_bidding" = "string"
  154. "purchasing_tag" = "string"
  155. "multipackage" = "int32"
  156. "isValidFile" = "bool"
  157. "bid_field" = "string"
  158. [db.es.fieldprojectinfo]
  159. "approvecode" = "string"
  160. "approvecontent" = "string"
  161. "approvestatus" = "string"
  162. "approvetime" = "string"
  163. "approvedept" = "string"
  164. "approvenumber" = "string"
  165. "projecttype" = "string"
  166. "approvecity" = "string"
  167. [db.es.fieldpurchasinglist]
  168. "itemname" = "string"
  169. "item" = "string"
  170. "brandname" = "string"
  171. "model" = "string"
  172. "unitname" = "string"
  173. "number" = "float64"
  174. "unitprice" = "float64"
  175. "totalprice" = "float64"
  176. [db.es.fieldprocurementlist]
  177. "projectname" = "string"
  178. "buyer" = "string"
  179. "item" = "string"
  180. "projectscope" = "string"
  181. "expurasingtime" = "string"
  182. "totalprice" = "float64"
  183. [db.es.fieldwinnerorder]
  184. "sort" = "int"
  185. "sortstr" = "string"
  186. "entname" = "string"
  187. `
  188. func TestInit(t *testing.T) {
  189. testfile := "/tmp/crocodile.toml"
  190. ioutil.WriteFile(testfile, []byte(confs), 0644)
  191. Init(testfile)
  192. t.Logf("%+v", Conf.DB.Mysql.DbnameMedical)
  193. os.Remove(testfile)
  194. }