chore: 使用环境变量管理内部密钥
This commit is contained in:
@@ -23,9 +23,9 @@ Ingest:
|
||||
AlertForward:
|
||||
enabled: true
|
||||
base_url: https://ops-api.apinb.com
|
||||
internal_key: "ops-alert"
|
||||
internal_key: ${LOGS_ALERT_SECRET}
|
||||
default_policy_id: 0
|
||||
|
||||
ResourceEvent:
|
||||
hmac_secret: "replace-with-dc-control-shared-secret"
|
||||
hmac_secret: ${DC_CONTROL_LOGS_EVENT_SECRET}
|
||||
max_skew_secs: 300
|
||||
|
||||
@@ -23,9 +23,9 @@ Ingest:
|
||||
AlertForward:
|
||||
enabled: true
|
||||
base_url: https://ops-api.apinb.com
|
||||
internal_key: "ops-alert"
|
||||
internal_key: ${LOGS_ALERT_SECRET}
|
||||
default_policy_id: 0
|
||||
|
||||
ResourceEvent:
|
||||
hmac_secret: "replace-with-dc-control-shared-secret"
|
||||
hmac_secret: ${DC_CONTROL_LOGS_EVENT_SECRET}
|
||||
max_skew_secs: 300
|
||||
|
||||
@@ -2,6 +2,7 @@ package config
|
||||
|
||||
import (
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/conf"
|
||||
)
|
||||
@@ -46,6 +47,12 @@ func New(srvKey string) {
|
||||
Spec.Port = conf.CheckPort(Spec.Port)
|
||||
Spec.BindIP = conf.CheckIP(Spec.BindIP)
|
||||
Spec.Addr = net.JoinHostPort(Spec.BindIP, Spec.Port)
|
||||
conf.NotNil(Spec.Service, Spec.Cache)
|
||||
Spec.ResourceEvent.HMACSecret = strings.TrimSpace(Spec.ResourceEvent.HMACSecret)
|
||||
conf.NotNil(Spec.Service, Spec.Cache, Spec.ResourceEvent.HMACSecret)
|
||||
if Spec.AlertForward != nil && Spec.AlertForward.Enabled {
|
||||
Spec.AlertForward.BaseURL = strings.TrimSpace(Spec.AlertForward.BaseURL)
|
||||
Spec.AlertForward.InternalKey = strings.TrimSpace(Spec.AlertForward.InternalKey)
|
||||
conf.NotNil(Spec.AlertForward.BaseURL, Spec.AlertForward.InternalKey)
|
||||
}
|
||||
conf.PrintInfo(Spec.Addr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user