refactor: Move secrets provider imports (no-changelog) (#11272)

This commit is contained in:
Val
2024-10-15 17:06:39 +01:00
committed by GitHub
parent c2fb881d61
commit aa3c0dd226
2 changed files with 7 additions and 3 deletions

View File

@@ -1,5 +1,4 @@
import { ClientSecretCredential } from '@azure/identity';
import { SecretClient } from '@azure/keyvault-secrets';
import type { SecretClient } from '@azure/keyvault-secrets';
import type { INodeProperties } from 'n8n-workflow';
import { DOCS_HELP_NOTICE, EXTERNAL_SECRETS_NAME_REGEX } from '@/external-secrets/constants';
@@ -72,6 +71,9 @@ export class AzureKeyVault implements SecretsProvider {
async connect() {
const { vaultName, tenantId, clientId, clientSecret } = this.settings;
const { ClientSecretCredential } = await import('@azure/identity');
const { SecretClient } = await import('@azure/keyvault-secrets');
try {
const credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
this.client = new SecretClient(`https://${vaultName}.vault.azure.net/`, credential);

View File

@@ -1,4 +1,4 @@
import { SecretManagerServiceClient as GcpClient } from '@google-cloud/secret-manager';
import type { SecretManagerServiceClient as GcpClient } from '@google-cloud/secret-manager';
import { jsonParse, type INodeProperties } from 'n8n-workflow';
import { DOCS_HELP_NOTICE, EXTERNAL_SECRETS_NAME_REGEX } from '@/external-secrets/constants';
@@ -45,6 +45,8 @@ export class GcpSecretsManager implements SecretsProvider {
async connect() {
const { projectId, privateKey, clientEmail } = this.settings;
const { SecretManagerServiceClient: GcpClient } = await import('@google-cloud/secret-manager');
try {
this.client = new GcpClient({
credentials: { client_email: clientEmail, private_key: privateKey },