Files
EdgeAdmin/internal/const/vars.go

33 lines
675 B
Go
Raw Normal View History

2024-05-17 17:56:37 +08:00
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
2021-07-20 17:15:17 +08:00
package teaconst
2023-03-21 11:41:40 +08:00
import (
"os"
"strings"
)
2021-07-20 17:15:17 +08:00
var (
IsRecoverMode = false
IsDemoMode = false
ErrorDemoOperation = "DEMO模式下无法进行创建、修改、删除等操作"
2021-12-21 15:18:11 +08:00
NewVersionCode = "" // 有新的版本
NewVersionDownloadURL = "" // 新版本下载地址
2023-03-21 11:41:40 +08:00
IsMain = checkMain()
)
2023-03-21 11:41:40 +08:00
// 检查是否为主程序
func checkMain() bool {
if len(os.Args) == 1 ||
(len(os.Args) >= 2 && os.Args[1] == "pprof") {
return true
}
exe, _ := os.Executable()
return strings.HasSuffix(exe, ".test") ||
strings.HasSuffix(exe, ".test.exe") ||
strings.Contains(exe, "___")
}