修改 topic 默认值

This commit is contained in:
余 欣怀 2023-03-13 20:58:37 +08:00
parent 98a6e56cb8
commit 30b584f0bd
2 changed files with 8 additions and 2 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@
out out
gen gen
runtime runtime
/vendor

View File

@ -70,13 +70,18 @@ func GenAliConfig(level Level) *AliLSConfig {
endpoint = "cn-hongkong.log.aliyuncs.com" endpoint = "cn-hongkong.log.aliyuncs.com"
} }
source := os.Getenv("GRLOG_SOURCE") source := os.Getenv("GRLOG_SOURCE")
appName := os.Getenv("GRLOG_APP_NAME")
topic := os.Getenv("GRLOG_TOPIC")
if topic == "" {
topic = appName
}
c := &AliLSConfig{ c := &AliLSConfig{
Project: project, Project: project,
Endpoint: endpoint, Endpoint: endpoint,
KeyID: "LTAI5tMA7iMGFfuc3xSRVCGQ", KeyID: "LTAI5tMA7iMGFfuc3xSRVCGQ",
KeySecret: "z98EpzmYmgiVLKizxP7pMF4BPbHfPV", KeySecret: "z98EpzmYmgiVLKizxP7pMF4BPbHfPV",
LogStore: os.Getenv("GRLOG_APP_NAME"), LogStore: appName,
Topics: []string{os.Getenv("GRLOG_TOPIC")}, Topics: []string{topic},
Source: source, Source: source,
Level: level, Level: level,
FlushWhen: 0, FlushWhen: 0,