修改配置读取

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