|
|
|
|
@ -1,16 +1,13 @@
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"log"
|
|
|
|
|
"net/http"
|
|
|
|
|
"os"
|
|
|
|
|
_ "src/init"
|
|
|
|
|
|
|
|
|
|
"github.com/towgo/towgo/dao/basedboperat"
|
|
|
|
|
"github.com/towgo/towgo/dao/ormDriver/gormDriver"
|
|
|
|
|
"github.com/towgo/towgo/dao/ormDriver/xormDriver"
|
|
|
|
|
"github.com/towgo/towgo/lib/processmanager"
|
|
|
|
|
"github.com/towgo/towgo/lib/system"
|
|
|
|
|
"github.com/towgo/towgo/towgo"
|
|
|
|
|
)
|
|
|
|
|
@ -18,17 +15,18 @@ import (
|
|
|
|
|
var appName string = "fushouxian-server"
|
|
|
|
|
var appVersion string = "1.0.0"
|
|
|
|
|
|
|
|
|
|
var basePath = system.GetPathOfProgram()
|
|
|
|
|
// var basePath = system.GetPathOfProgram()
|
|
|
|
|
var basePath = "E:\\workfile\\FuShouXian-Backend\\apps\\fushouxian-server"
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
//初始化xorm数据库驱动
|
|
|
|
|
var dbconfig []xormDriver.DsnConfig
|
|
|
|
|
system.ScanConfigJson(basePath+"/config/dbconfig.json", &dbconfig)
|
|
|
|
|
system.ScanConfigJson(basePath+"\\config\\dbconfig.json", &dbconfig)
|
|
|
|
|
xormDriver.New(dbconfig)
|
|
|
|
|
|
|
|
|
|
//初始化gorm数据库驱动
|
|
|
|
|
var gormdbconfig []gormDriver.DsnConfig
|
|
|
|
|
system.ScanConfigJson(basePath+"/config/dbconfig.json", &gormdbconfig)
|
|
|
|
|
system.ScanConfigJson(basePath+"\\config\\dbconfig.json", &gormdbconfig)
|
|
|
|
|
gormDriver.New(gormdbconfig)
|
|
|
|
|
|
|
|
|
|
//设定默认orm引擎
|
|
|
|
|
@ -39,7 +37,7 @@ func init() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
func main() {
|
|
|
|
|
pm := processmanager.GetManager()
|
|
|
|
|
/*pm := processmanager.GetManager()
|
|
|
|
|
for k, v := range os.Args {
|
|
|
|
|
switch v {
|
|
|
|
|
case "start":
|
|
|
|
|
@ -83,7 +81,8 @@ func main() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
log.Print("参数传递错误,有效参数如下:\n" + os.Args[0] + " start | stop | reload | stop")
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
start()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func start() {
|
|
|
|
|
@ -93,7 +92,7 @@ func start() {
|
|
|
|
|
conf := struct {
|
|
|
|
|
Serverport string `json:"serverport"`
|
|
|
|
|
}{}
|
|
|
|
|
system.ScanConfigJson(basePath+"/config/config.json", &conf)
|
|
|
|
|
system.ScanConfigJson(basePath+"\\config\\config.json", &conf)
|
|
|
|
|
|
|
|
|
|
http.HandleFunc("/jsonrpc", towgo.HttpHandller)
|
|
|
|
|
|
|
|
|
|
@ -103,7 +102,7 @@ func start() {
|
|
|
|
|
|
|
|
|
|
func moduleClientInit() {
|
|
|
|
|
var node towgo.EdgeServerNodeConfig
|
|
|
|
|
system.ScanConfigJson(basePath+"config/togocdn.client.config.json", &node)
|
|
|
|
|
system.ScanConfigJson(basePath+"\\config\\togocdn.client.config.json", &node)
|
|
|
|
|
node.Methods = towgo.GetMethods()
|
|
|
|
|
node.ModuleName = appName
|
|
|
|
|
for _, v := range node.ServerUrls {
|
|
|
|
|
|