Skip to content

Commit

Permalink
feat: adjust application variable init (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
B15030328 authored Feb 8, 2023
1 parent dd467f0 commit c7f62df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion pkg/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var (
)

func InitEnv() {
appID = os.Getenv(constant.EnvAppID)
appLogDir = os.Getenv(constant.EnvAppLogDir)
appMode = os.Getenv(constant.EnvAppMode)
appRegion = os.Getenv(constant.EnvAppRegion)
Expand Down
10 changes: 6 additions & 4 deletions pkg/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ func init() {
appName = filepath.Base(os.Args[0])
}
}

if appID == "" {
appID = os.Getenv(constant.EnvAppID)
if appID == "" {
appID = "1234567890"
}
}
name, err := os.Hostname()
if err != nil {
name = "unknown"
Expand All @@ -79,9 +84,6 @@ func SetName(s string) {

// AppID get appID
func AppID() string {
if appID == "" {
return "1234567890" //default appid when APP_ID Env var not set
}
return appID
}

Expand Down

0 comments on commit c7f62df

Please sign in to comment.