Преглед изворни кода

Merge pull request #1424 from spieglt/vault-namespaces

Add namespace field to VaultCAS JSON config
Mariano Cano пре 3 година
родитељ
комит
ccb248394b
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      cas/vaultcas/vaultcas.go

+ 5 - 0
cas/vaultcas/vaultcas.go

@@ -37,6 +37,7 @@ type VaultOptions struct {
 	PKIRoleEd25519 string          `json:"pkiRoleEd25519,omitempty"`
 	AuthType       string          `json:"authType,omitempty"`
 	AuthMountPath  string          `json:"authMountPath,omitempty"`
+	Namespace      string          `json:"namespace,omitempty"`
 	AuthOptions    json.RawMessage `json:"authOptions,omitempty"`
 }
 
@@ -90,6 +91,10 @@ func New(ctx context.Context, opts apiv1.Options) (*VaultCAS, error) {
 		return nil, fmt.Errorf("unable to configure %s auth method: %w", vc.AuthType, err)
 	}
 
+	if vc.Namespace != "" {
+		client.SetNamespace(vc.Namespace)
+	}
+
 	authInfo, err := client.Auth().Login(ctx, method)
 	if err != nil {
 		return nil, fmt.Errorf("unable to login to %s auth method: %w", vc.AuthType, err)