diff --git a/conf/app.conf.example b/conf/app.conf.example index 3a785d09..1113b0ff 100644 --- a/conf/app.conf.example +++ b/conf/app.conf.example @@ -74,6 +74,7 @@ mail_expired=30 secure=LOGIN ###############配置导出项目################### +enable_export=true #同一个项目同时运行导出程序的并行数量,取值1-4之间,取值越大导出速度越快,越占用资源 export_process_num=1 diff --git a/conf/enumerate.go b/conf/enumerate.go index c2ae126f..2c9c49dc 100644 --- a/conf/enumerate.go +++ b/conf/enumerate.go @@ -137,6 +137,10 @@ func GetUploadFileSize() int64 { } return 0 } +//是否启用导出 +func GetEnableExport() bool { + return beego.AppConfig.DefaultBool("enable_export",true) +} //同一项目导出线程的并发数 func GetExportProcessNum() int { exportProcessNum := beego.AppConfig.DefaultInt("export_process_num",1) diff --git a/controllers/DocumentController.go b/controllers/DocumentController.go index ca9045b8..1a24d027 100644 --- a/controllers/DocumentController.go +++ b/controllers/DocumentController.go @@ -823,6 +823,9 @@ func (c *DocumentController) Export() { promptUserToLogIn(c) return } + if !conf.GetEnableExport() { + c.ShowErrorPage(500,"系统没有开启导出功能") + } bookResult := models.NewBookResult() if c.Member != nil && c.Member.IsAdministrator() { diff --git a/start.sh b/start.sh index 3fc9e73d..2de89834 100644 --- a/start.sh +++ b/start.sh @@ -80,6 +80,11 @@ if [ ! -z $BASEURL ]; then sed -i "s#baseurl=.*#baseurl=$BASEURL#g" conf/app.conf fi +if [ ! -z $ENABLE_EXPORT ]; then + sed -i "s#enable_export=.*#baseurl=$ENABLE_EXPORT#g" conf/app.conf +fi + + sed -i 's/^runmode.*/runmode=prod/g' conf/app.conf /mindoc/mindoc_linux_amd64 install