v1.3.3 暴露两个配置方法

This commit is contained in:
liangzy 2020-05-06 15:34:47 +08:00
parent ce9ab060d9
commit cd94900f19

View File

@ -55,7 +55,7 @@ var adatperSetMapper = map[Adapter]func(l *Logger, level Level) error{
}, },
} }
func GenAliConfig(level Level) AliLSConfig { func GenAliConfig(level Level) *AliLSConfig {
var project string = "gaore-app-logstore" var project string = "gaore-app-logstore"
var endpoint string var endpoint string
@ -65,7 +65,7 @@ func GenAliConfig(level Level) AliLSConfig {
endpoint = project + ".cn-shenzhen.log.aliyuncs.com" endpoint = project + ".cn-shenzhen.log.aliyuncs.com"
} }
c := AliLSConfig{ c := &AliLSConfig{
Project: project, Project: project,
Endpoint: endpoint, Endpoint: endpoint,
KeyID: "LTAI4GCHwcqtrFD4DHRHxR4k", KeyID: "LTAI4GCHwcqtrFD4DHRHxR4k",
@ -79,13 +79,13 @@ func GenAliConfig(level Level) AliLSConfig {
return c return c
} }
func GenEsConfig(level Level) EsConfig { func GenEsConfig(level Level) *EsConfig {
dsn := "http://es-cn-0pp1mm3hq000dnbh4.public.elasticsearch.aliyuncs.com:9200/" dsn := "http://es-cn-0pp1mm3hq000dnbh4.public.elasticsearch.aliyuncs.com:9200/"
if os.Getenv(envkey) == "prod" || os.Getenv(envkey) == "" || os.Getenv(envkey) == "gray" { if os.Getenv(envkey) == "prod" || os.Getenv(envkey) == "" || os.Getenv(envkey) == "gray" {
dsn = "http://es-cn-0pp1mm3hq000dnbh4.elasticsearch.aliyuncs.com:9200/" dsn = "http://es-cn-0pp1mm3hq000dnbh4.elasticsearch.aliyuncs.com:9200/"
} }
c := EsConfig{ c := &EsConfig{
Username: "elastic", Username: "elastic",
Password: "Hellogaore@", Password: "Hellogaore@",
Dsn: dsn, Dsn: dsn,