fix 启动报错的问题

This commit is contained in:
陈景阳
2020-02-01 12:53:44 +08:00
parent fcfaf8ba77
commit 100e7631fb
4 changed files with 25 additions and 12 deletions

View File

@@ -1,25 +1,25 @@
api:
address: "localhost:8000"
mongo:
host: localhost
host: "192.168.235.26"
port: 27017
db: crawlab_test
username: ""
password: ""
db: crawlab_dev
username: "root"
password: "example"
authSource: "admin"
redis:
address: localhost
password: ""
address: 127.0.0.1
password:
database: 1
port: 6379
log:
level: info
path: "/var/logs/crawlab"
path: "./logs/crawlab"
isDeletePeriodically: "N"
deleteFrequency: "@hourly"
server:
host: 0.0.0.0
port: 8000
port: 8001
master: "Y"
secret: "crawlab"
register:
@@ -30,11 +30,11 @@ server:
python: "Y"
node: "N"
spider:
path: "/app/spiders"
path: "./spiders"
task:
workers: 4
other:
tmppath: "/tmp"
tmppath: "./tmp"
version: 0.4.4
setting:
allowRegister: "N"

View File

@@ -231,8 +231,6 @@ func main() {
}
// 统计数据
authGroup.GET("/stats/home", routes.GetHomeStats) // 首页统计数据
// release版本
authGroup.GET("/version", routes.GetVersion) // 获取发布的版本
// 文件
authGroup.GET("/file", routes.GetFile) // 获取文件
}

View File

@@ -200,6 +200,12 @@ func (s *Scheduler) Update() error {
return err
}
user, err := model.GetUserByUsername("admin")
if err != nil {
log.Errorf("get admin user error: %s", err.Error())
return err
}
// 遍历任务列表
for i := 0; i < len(sList); i++ {
// 单个任务
@@ -209,6 +215,11 @@ func (s *Scheduler) Update() error {
continue
}
// 兼容以前版本
if job.UserId.Hex() == "" {
job.UserId = user.Id
}
// 添加到定时任务
if err := s.AddJob(job); err != nil {
log.Errorf("add job error: %s, job: %s, cron: %s", err.Error(), job.Name, job.Cron)

View File

@@ -1,3 +1,7 @@
NODE_ENV='development'
<<<<<<< Updated upstream
VUE_APP_BASE_URL=http://localhost:8000
VUE_APP_CRAWLAB_BASE_URL=https://api.crawlab.cn
=======
VUE_APP_BASE_URL=http://localhost:8001
>>>>>>> Stashed changes