feat: External Secrets storage for credentials (#6477)
Github issue / Community forum post (link here to close automatically): --------- Co-authored-by: Romain Minaud <romain.minaud@gmail.com> Co-authored-by: Valya Bullions <valya@n8n.io> Co-authored-by: Csaba Tuncsik <csaba@n8n.io> Co-authored-by: Giulio Andreini <g.andreini@gmail.com> Co-authored-by: Omar Ajoue <krynble@gmail.com>
This commit is contained in:
41
packages/cli/src/SecretsHelpers.ts
Normal file
41
packages/cli/src/SecretsHelpers.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import type { IDataObject, SecretsHelpersBase } from 'n8n-workflow';
|
||||
import { Service } from 'typedi';
|
||||
import { ExternalSecretsManager } from './ExternalSecrets/ExternalSecretsManager.ee';
|
||||
|
||||
@Service()
|
||||
export class SecretsHelper implements SecretsHelpersBase {
|
||||
constructor(private service: ExternalSecretsManager) {}
|
||||
|
||||
async update() {
|
||||
if (!this.service.initialized) {
|
||||
await this.service.init();
|
||||
}
|
||||
await this.service.updateSecrets();
|
||||
}
|
||||
|
||||
async waitForInit() {
|
||||
if (!this.service.initialized) {
|
||||
await this.service.init();
|
||||
}
|
||||
}
|
||||
|
||||
getSecret(provider: string, name: string): IDataObject | undefined {
|
||||
return this.service.getSecret(provider, name);
|
||||
}
|
||||
|
||||
hasSecret(provider: string, name: string): boolean {
|
||||
return this.service.hasSecret(provider, name);
|
||||
}
|
||||
|
||||
hasProvider(provider: string): boolean {
|
||||
return this.service.hasProvider(provider);
|
||||
}
|
||||
|
||||
listProviders(): string[] {
|
||||
return this.service.getProviderNames() ?? [];
|
||||
}
|
||||
|
||||
listSecrets(provider: string): string[] {
|
||||
return this.service.getSecretNames(provider) ?? [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user