feat:实现Modules支持

3.0.0
lifeilin01 2020-06-14 14:59:50 +08:00
parent 7104698000
commit 693de8f293
4 changed files with 18 additions and 18 deletions

View File

@ -286,7 +286,7 @@ func ResolveCommand(args []string) {
if err := flagSet.Parse(args); err != nil { if err := flagSet.Parse(args); err != nil {
log.Fatal("解析命令失败 ->", err) log.Fatal("解析命令失败 ->", err)
} }
fmt.Println(conf.WorkingDirectory)
if conf.WorkingDirectory == "" { if conf.WorkingDirectory == "" {
if p, err := filepath.Abs(os.Args[0]); err == nil { if p, err := filepath.Abs(os.Args[0]); err == nil {
conf.WorkingDirectory = filepath.Dir(p) conf.WorkingDirectory = filepath.Dir(p)
@ -519,7 +519,7 @@ func init() {
conf.ConfigurationFile = configPath conf.ConfigurationFile = configPath
} }
if err := gocaptcha.ReadFonts(conf.WorkingDir("static", "fonts"), ".ttf"); err != nil { if err := gocaptcha.ReadFonts(conf.WorkingDir("static", "fonts"), ".ttf"); err != nil {
log.Fatal("读取字体文件失败 ->", err) beego.Error("读取字体文件失败 ->", err)
} }
gob.Register(models.Member{}) gob.Register(models.Member{})

View File

@ -2,13 +2,14 @@
package conf package conf
import ( import (
"os/exec"
"strings" "strings"
"github.com/astaxie/beego"
"strconv"
"path/filepath"
"os"
"fmt" "fmt"
"github.com/astaxie/beego"
"os"
"path/filepath"
"strconv"
) )
// 登录用户的Session名 // 登录用户的Session名
@ -158,7 +159,7 @@ func GetExportProcessNum() int {
if exportProcessNum <= 0 || exportProcessNum > 4 { if exportProcessNum <= 0 || exportProcessNum > 4 {
exportProcessNum = 1 exportProcessNum = 1
} }
return exportProcessNum; return exportProcessNum
} }
//导出项目队列的并发数量 //导出项目队列的并发数量
@ -168,7 +169,7 @@ func GetExportLimitNum() int {
if exportLimitNum < 0 { if exportLimitNum < 0 {
exportLimitNum = 1 exportLimitNum = 1
} }
return exportLimitNum; return exportLimitNum
} }
//等待导出队列的长度 //等待导出队列的长度
@ -344,12 +345,12 @@ func WorkingDir(elem ...string) string {
} }
func init() { func init() {
if p, err := exec.LookPath(os.Args[0]); err == nil {
WorkingDirectory = p
}
if p, err := filepath.Abs("./conf/app.conf"); err == nil { if p, err := filepath.Abs("./conf/app.conf"); err == nil {
ConfigurationFile = p ConfigurationFile = p
} }
if p, err := filepath.Abs("./"); err == nil {
WorkingDirectory = p
}
if p, err := filepath.Abs("./runtime/logs"); err == nil { if p, err := filepath.Abs("./runtime/logs"); err == nil {
LogFile = p LogFile = p
} }

2
go.mod
View File

@ -9,7 +9,7 @@ require (
github.com/howeyc/fsnotify v0.9.0 github.com/howeyc/fsnotify v0.9.0
github.com/kardianos/service v1.1.0 github.com/kardianos/service v1.1.0
github.com/lifei6671/gocaptcha v0.1.1 github.com/lifei6671/gocaptcha v0.1.1
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect github.com/mattn/go-sqlite3 v2.0.3+incompatible
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
github.com/russross/blackfriday v1.5.2 github.com/russross/blackfriday v1.5.2
github.com/russross/blackfriday/v2 v2.0.1 github.com/russross/blackfriday/v2 v2.0.1

View File

@ -16,7 +16,6 @@ import (
) )
func main() { func main() {
if len(os.Args) >= 3 && os.Args[1] == "service" { if len(os.Args) >= 3 && os.Args[1] == "service" {
if os.Args[2] == "install" { if os.Args[2] == "install" {
daemon.Install() daemon.Install()