feat: omc原始代码

This commit is contained in:
TsMask
2024-03-12 10:58:33 +08:00
parent 5133c93971
commit 2d01bb86d1
432 changed files with 66597 additions and 1 deletions

36
lib/core/conf/conf.go Normal file
View File

@@ -0,0 +1,36 @@
package conf
import (
"fmt"
"github.com/spf13/viper"
)
var v *viper.Viper
// 配置文件读取
func InitConfig(configFile string) {
v = viper.New()
// 设置配置文件路径
v.SetConfigFile(configFile)
// 读取配置文件
err := v.ReadInConfig()
if err != nil {
fmt.Printf("读取配置文件失败: %v \n", err)
return
}
}
// Get 获取配置信息
//
// Get("framework.name")
func Get(key string) any {
return v.Get(key)
}
// AllSettings 全部配置信息
func AllSettings() map[string]interface{} {
return v.AllSettings()
}