From 59118cf8f28ddd284bdcaed28c58e25400a06773 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 17 Sep 2024 18:54:13 +0800 Subject: [PATCH] dev --- env/env.go | 14 ++++++++++++-- go.mod | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/env/env.go b/env/env.go index faaa23b..74c2d7f 100644 --- a/env/env.go +++ b/env/env.go @@ -5,7 +5,6 @@ import ( "strings" "git.apinb.com/bsm-sdk/engine/types" - "git.apinb.com/bsm-sdk/engine/utils" ) var MeshEnv *types.MeshEnv = nil @@ -15,7 +14,7 @@ func NewEnv() *types.MeshEnv { if MeshEnv == nil { MeshEnv = &types.MeshEnv{ Workspace: GetEnvDefault("BlocksMesh_Workspace", "bsm"), - Prefix: GetEnvDefault("BlocksMesh_Prefix", utils.GetCurrentPath()), + Prefix: GetEnvDefault("BlocksMesh_Prefix", "/usr/local/bsm"), JwtSecretKey: GetEnvDefault("BlocksMesh_JwtSecretKey", "Cblocksmesh2022C"), RuntimeMode: strings.ToLower(GetEnvDefault("BlocksMesh_RuntimeMode", "dev")), } @@ -23,6 +22,17 @@ func NewEnv() *types.MeshEnv { return MeshEnv } +// get system base env. +func NewBaseEnv() *types.MeshEnv { + if MeshEnv == nil { + MeshEnv = &types.MeshEnv{ + Prefix: GetEnvDefault("BlocksMesh_Prefix", "/usr/local/bsm"), + RuntimeMode: strings.ToLower(GetEnvDefault("BlocksMesh_RuntimeMode", "dev")), + } + } + return MeshEnv +} + func GetEnvDefault(key string, def string) string { value := os.Getenv(key) if value == "" { diff --git a/go.mod b/go.mod index baa2731..a07cc11 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module git.apinb.com/bsm-sdk/engine -go 1.22 +go 1.23