refactor: Move secrets provider imports (no-changelog) (#11272)
Some checks failed
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Has been cancelled

This commit is contained in:
Val 2024-10-15 17:06:39 +01:00 committed by GitHub
parent c2fb881d61
commit aa3c0dd226
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View file

@ -1,5 +1,4 @@
import { ClientSecretCredential } from '@azure/identity'; import type { SecretClient } from '@azure/keyvault-secrets';
import { SecretClient } from '@azure/keyvault-secrets';
import type { INodeProperties } from 'n8n-workflow'; import type { INodeProperties } from 'n8n-workflow';
import { DOCS_HELP_NOTICE, EXTERNAL_SECRETS_NAME_REGEX } from '@/external-secrets/constants'; import { DOCS_HELP_NOTICE, EXTERNAL_SECRETS_NAME_REGEX } from '@/external-secrets/constants';
@ -72,6 +71,9 @@ export class AzureKeyVault implements SecretsProvider {
async connect() { async connect() {
const { vaultName, tenantId, clientId, clientSecret } = this.settings; const { vaultName, tenantId, clientId, clientSecret } = this.settings;
const { ClientSecretCredential } = await import('@azure/identity');
const { SecretClient } = await import('@azure/keyvault-secrets');
try { try {
const credential = new ClientSecretCredential(tenantId, clientId, clientSecret); const credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
this.client = new SecretClient(`https://${vaultName}.vault.azure.net/`, credential); 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 { jsonParse, type INodeProperties } from 'n8n-workflow';
import { DOCS_HELP_NOTICE, EXTERNAL_SECRETS_NAME_REGEX } from '@/external-secrets/constants'; import { DOCS_HELP_NOTICE, EXTERNAL_SECRETS_NAME_REGEX } from '@/external-secrets/constants';
@ -45,6 +45,8 @@ export class GcpSecretsManager implements SecretsProvider {
async connect() { async connect() {
const { projectId, privateKey, clientEmail } = this.settings; const { projectId, privateKey, clientEmail } = this.settings;
const { SecretManagerServiceClient: GcpClient } = await import('@google-cloud/secret-manager');
try { try {
this.client = new GcpClient({ this.client = new GcpClient({
credentials: { client_email: clientEmail, private_key: privateKey }, credentials: { client_email: clientEmail, private_key: privateKey },