diff --git a/cmd/certificate_maker/certificate_maker.go b/cmd/certificate_maker/certificate_maker.go index 4cae6bd1..5361a342 100644 --- a/cmd/certificate_maker/certificate_maker.go +++ b/cmd/certificate_maker/certificate_maker.go @@ -119,7 +119,7 @@ func runCreate(_ *cobra.Command, _ []string) error { // Handle KMS provider options switch config.Type { case "gcpkms": - if credsFile := getConfigValue(kmsCredsFile, "KMS_CREDENTIALS_FILE"); credsFile != "" { + if credsFile := getConfigValue(kmsCredsFile, "GCP_CREDENTIALS_FILE"); credsFile != "" { // Check if credentials file exists before trying to use it if _, err := os.Stat(credsFile); err != nil { if os.IsNotExist(err) { @@ -130,7 +130,7 @@ func runCreate(_ *cobra.Command, _ []string) error { config.Options["credentials-file"] = credsFile } case "azurekms": - if tenantID := getConfigValue(kmsTenantID, "KMS_TENANT_ID"); tenantID != "" { + if tenantID := getConfigValue(kmsTenantID, "AZURE_TENANT_ID"); tenantID != "" { config.Options["tenant-id"] = tenantID } } diff --git a/cmd/certificate_maker/certificate_maker_test.go b/cmd/certificate_maker/certificate_maker_test.go index 9ae4a91d..8b0844d0 100644 --- a/cmd/certificate_maker/certificate_maker_test.go +++ b/cmd/certificate_maker/certificate_maker_test.go @@ -54,6 +54,20 @@ func TestGetConfigValue(t *testing.T) { envValue: "", want: "", }, + { + name: "GCP credentials file from env", + flagValue: "", + envVar: "GCP_CREDENTIALS_FILE", + envValue: "/path/to/creds.json", + want: "/path/to/creds.json", + }, + { + name: "Azure tenant ID from env", + flagValue: "", + envVar: "AZURE_TENANT_ID", + envValue: "tenant-123", + want: "tenant-123", + }, } for _, tt := range tests {