修改配置读取

This commit is contained in:
junleea 2025-08-02 15:49:35 +08:00
parent e1e7e53590
commit 301817c353
1 changed files with 20 additions and 17 deletions

37
main.go
View File

@ -60,24 +60,27 @@ func main() {
ReadConfigToSetSystem()
r.Run(":" + proto.Config.SERVER_PORT) // listen and serve on 0.0.0.0:8083
}
func init() {
// 创建cid的目录
os.MkdirAll(proto.CID_BASE_DIR, os.ModePerm)
os.MkdirAll(proto.CID_BASE_DIR+"script", os.ModePerm)
os.MkdirAll(proto.CID_BASE_DIR+"workspace", os.ModePerm)
//读取配置文件
//文件地址/home/videoplayer/vp.conf
configPath := "/home/videoplayer/vp.conf"
//读取配置文件
err := proto.ReadConfig(configPath)
if err != nil {
panic("failed to read config file:" + err.Error())
}
}
// 不使用
//
// func init() {
// // 创建cid的目录
// os.MkdirAll(proto.CID_BASE_DIR, os.ModePerm)
// os.MkdirAll(proto.CID_BASE_DIR+"script", os.ModePerm)
// os.MkdirAll(proto.CID_BASE_DIR+"workspace", os.ModePerm)
// //读取配置文件
// //文件地址/home/videoplayer/vp.conf
// configPath := "/home/videoplayer/vp.conf"
// //读取配置文件
// err := proto.ReadConfig(configPath)
// if err != nil {
// panic("failed to read config file:" + err.Error())
// }
// }
func initConfig(configPath string) {
if proto.Config.TOKEN_SECRET != "" {
return
}
//if proto.Config.TOKEN_SECRET != "" {
// return
//}
// 创建cid的目录
os.MkdirAll(proto.CID_BASE_DIR, os.ModePerm)
os.MkdirAll(proto.CID_BASE_DIR+"script", os.ModePerm)