dev
This commit is contained in:
parent
aada90ea78
commit
59118cf8f2
|
@ -5,7 +5,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.apinb.com/bsm-sdk/engine/types"
|
"git.apinb.com/bsm-sdk/engine/types"
|
||||||
"git.apinb.com/bsm-sdk/engine/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var MeshEnv *types.MeshEnv = nil
|
var MeshEnv *types.MeshEnv = nil
|
||||||
|
@ -15,7 +14,7 @@ func NewEnv() *types.MeshEnv {
|
||||||
if MeshEnv == nil {
|
if MeshEnv == nil {
|
||||||
MeshEnv = &types.MeshEnv{
|
MeshEnv = &types.MeshEnv{
|
||||||
Workspace: GetEnvDefault("BlocksMesh_Workspace", "bsm"),
|
Workspace: GetEnvDefault("BlocksMesh_Workspace", "bsm"),
|
||||||
Prefix: GetEnvDefault("BlocksMesh_Prefix", utils.GetCurrentPath()),
|
Prefix: GetEnvDefault("BlocksMesh_Prefix", "/usr/local/bsm"),
|
||||||
JwtSecretKey: GetEnvDefault("BlocksMesh_JwtSecretKey", "Cblocksmesh2022C"),
|
JwtSecretKey: GetEnvDefault("BlocksMesh_JwtSecretKey", "Cblocksmesh2022C"),
|
||||||
RuntimeMode: strings.ToLower(GetEnvDefault("BlocksMesh_RuntimeMode", "dev")),
|
RuntimeMode: strings.ToLower(GetEnvDefault("BlocksMesh_RuntimeMode", "dev")),
|
||||||
}
|
}
|
||||||
|
@ -23,6 +22,17 @@ func NewEnv() *types.MeshEnv {
|
||||||
return 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 {
|
func GetEnvDefault(key string, def string) string {
|
||||||
value := os.Getenv(key)
|
value := os.Getenv(key)
|
||||||
if value == "" {
|
if value == "" {
|
||||||
|
|
Loading…
Reference in New Issue