opensearch 계정이 없을 때 헤더 처리
This commit is contained in:
@ -328,13 +328,13 @@ func NewClient(ctx context.Context, cfg Config) (Client, error) {
|
||||
indexPrefix = "ds-logs-" + indexPrefix
|
||||
}
|
||||
|
||||
authHeader := fmt.Sprintf("Basic %s", base64.RawURLEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", cfg.Username, cfg.Password))))
|
||||
|
||||
bulkHeader := make(http.Header)
|
||||
bulkHeader.Set("Authorization", authHeader)
|
||||
|
||||
singleHeader := make(http.Header)
|
||||
singleHeader.Set("Authorization", authHeader)
|
||||
if len(cfg.Username) > 0 && len(cfg.Password) > 0 {
|
||||
authHeader := fmt.Sprintf("Basic %s", base64.RawURLEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", cfg.Username, cfg.Password))))
|
||||
bulkHeader.Set("Authorization", authHeader)
|
||||
singleHeader.Set("Authorization", authHeader)
|
||||
}
|
||||
|
||||
out := Client{
|
||||
Client: client,
|
||||
|
||||
Reference in New Issue
Block a user