perf: 重构目录结构
This commit is contained in:
@@ -12,9 +12,15 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
|
||||
libConfig "be.ems/lib/config"
|
||||
libGlobal "be.ems/lib/global"
|
||||
)
|
||||
|
||||
var (
|
||||
Version string = "-"
|
||||
BuildTime string = "-"
|
||||
GoVer string = "-"
|
||||
)
|
||||
|
||||
// 程序配置
|
||||
var conf *viper.Viper
|
||||
|
||||
// 初始化程序配置
|
||||
@@ -28,9 +34,9 @@ func InitConfig(configDir *embed.FS) {
|
||||
func initFlag() {
|
||||
// --env prod
|
||||
pflag.String("env", "prod", "Specify Run Environment Configuration local or prod")
|
||||
// --c /etc/restconf.yaml
|
||||
// -c /etc/restconf.yaml
|
||||
pflag.StringP("config", "c", "./etc/restconf.yaml", "Specify Configuration File")
|
||||
// --c /usr/local/etc/omc/omc.yaml
|
||||
// -c /usr/local/etc/omc/omc.yaml
|
||||
pflag.StringP("config", "c", "/usr/local/etc/omc/omc.yaml", "Specify Configuration File")
|
||||
// --sqlPath ./sql/20250228.sql
|
||||
pflag.String("sqlPath", "", "Execution SQL File Path")
|
||||
// --sqlSource default
|
||||
@@ -45,7 +51,7 @@ func initFlag() {
|
||||
|
||||
// 参数固定输出
|
||||
if *pVersion {
|
||||
buildInfo := fmt.Sprintf("OMC version: %s\n%s\n%s\n\n", libGlobal.Version, libGlobal.BuildTime, libGlobal.GoVer)
|
||||
buildInfo := fmt.Sprintf("OMC \nBuildVer: %s\nBuildTime: %s\nBuildEnv: %s\n", Version, BuildTime, GoVer)
|
||||
fmt.Println(buildInfo)
|
||||
os.Exit(1)
|
||||
}
|
||||
@@ -74,7 +80,7 @@ func initViper(configDir *embed.FS) {
|
||||
|
||||
// 当期服务环境运行配置 => local
|
||||
env := conf.GetString("env")
|
||||
log.Printf("current service environment operation configuration => %s \n", env)
|
||||
log.Printf("current service environment configuration => %s \n", env)
|
||||
|
||||
// 加载运行配置文件合并相同配置
|
||||
envConfigPath := fmt.Sprintf("config/config.%s.yaml", env)
|
||||
|
||||
@@ -13,11 +13,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
libGlobal "be.ems/lib/global"
|
||||
"be.ems/src/framework/config"
|
||||
)
|
||||
|
||||
// userAgent 自定义 User-Agent
|
||||
var userAgent = fmt.Sprintf("OMC/%s", libGlobal.Version)
|
||||
var userAgent = fmt.Sprintf("OMC/%s", config.Version)
|
||||
|
||||
// Get 发送 GET 请求
|
||||
// timeout 超时时间(毫秒)
|
||||
|
||||
Reference in New Issue
Block a user