diff --git a/pkg/kt/gcp.go b/pkg/kt/gcp.go index 4b1900ad..c1220222 100644 --- a/pkg/kt/gcp.go +++ b/pkg/kt/gcp.go @@ -14,7 +14,8 @@ import ( ) var ( - gSMClient *secretmanager.Client + gSMClient *secretmanager.Client + gcpProject = "" ) const ( @@ -34,7 +35,17 @@ func loadViaGCPSecrets(key string) string { gSMClient = client } + // We need this project explicitly set for us also. + if gcpProject == "" { + gcpProject = LookupEnvString("GOOGLE_CLOUD_PROJECT", "") + if gcpProject == "" { + log.Printf("Missing env var GOOGLE_CLOUD_PROJECT") + return fmt.Sprintf("Missing env var GOOGLE_CLOUD_PROJECT") + } + } + // Build the request. + key = fmt.Sprintf("projects/%s/secrets/%s/versions/latest", gcpProject, key) req := &secretmanagerpb.AccessSecretVersionRequest{ Name: key, } diff --git a/pkg/kt/snmp.go b/pkg/kt/snmp.go index 2a77774d..5cc642df 100644 --- a/pkg/kt/snmp.go +++ b/pkg/kt/snmp.go @@ -528,6 +528,11 @@ func (a *StringArray) UnmarshalYAML(unmarshal func(interface{}) error) error { type V3SNMP V3SNMPConfig // Need a 2nd type alias to avoid stack overflow on parsing. +func (a *V3SNMPConfig) String() string { + return fmt.Sprintf("UserName: %s, AuthenticationProtocol: %s, AuthenticationPassphrase: %s PrivacyProtocol: %s PrivacyPassphrase: %s ContextEngineID: %s ContextName: %s", + a.UserName, a.AuthenticationProtocol, a.AuthenticationPassphrase, a.PrivacyProtocol, a.PrivacyPassphrase, a.ContextEngineID, a.ContextName) +} + // Make sure that things serialize back to how they were. func (a *V3SNMPConfig) MarshalYAML() (interface{}, error) { if a.origStr != "" {