|
@@ -0,0 +1,33 @@
|
|
|
+package main
|
|
|
+
|
|
|
+import (
|
|
|
+ . "apiservice/config"
|
|
|
+ _ "apiservice/oamanager"
|
|
|
+ "log"
|
|
|
+ "qfw/util"
|
|
|
+ "qfw/util/elastic"
|
|
|
+ "qfw/util/redis"
|
|
|
+
|
|
|
+ "github.com/go-xweb/xweb"
|
|
|
+)
|
|
|
+
|
|
|
+func init() {
|
|
|
+ initXweb()
|
|
|
+ redis.InitRedisBySize(Sysconfig["redisaddrs"].(string), 100, 30, 300)
|
|
|
+ elastic.InitElasticSize(Sysconfig["elasticsearch"].(string), util.IntAllDef(Sysconfig["elasticPoolSize"], 30))
|
|
|
+}
|
|
|
+
|
|
|
+func main() {
|
|
|
+ log.Println(Sysconfig["webport"].(string))
|
|
|
+ go func() {
|
|
|
+ xweb.Run(":" + Sysconfig["webport"].(string))
|
|
|
+ }()
|
|
|
+ b := make(chan bool, 1)
|
|
|
+ <-b
|
|
|
+}
|
|
|
+
|
|
|
+func initXweb() {
|
|
|
+ xweb.RootApp().AppConfig.TemplateDir = "web/templates"
|
|
|
+ xweb.RootApp().AppConfig.StaticDir = "web/staticres"
|
|
|
+ xweb.RootApp().AppConfig.ReloadTemplates = true
|
|
|
+}
|