refactor(core): Port external secrets config (no-changelog) (#10094)
This commit is contained in:
12
packages/@n8n/config/src/configs/external-secrets.ts
Normal file
12
packages/@n8n/config/src/configs/external-secrets.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Config, Env } from '../decorators';
|
||||
|
||||
@Config
|
||||
export class ExternalSecretsConfig {
|
||||
/** How often (in seconds) to check for secret updates */
|
||||
@Env('N8N_EXTERNAL_SECRETS_UPDATE_INTERVAL')
|
||||
readonly updateInterval: number = 300;
|
||||
|
||||
/** Whether to prefer GET over LIST when fetching secrets from Hashicorp Vault */
|
||||
@Env('N8N_EXTERNAL_SECRETS_PREFER_GET')
|
||||
readonly preferGet: boolean = false;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import { DatabaseConfig } from './configs/database';
|
||||
import { EmailConfig } from './configs/email';
|
||||
import { VersionNotificationsConfig } from './configs/version-notifications';
|
||||
import { PublicApiConfig } from './configs/public-api';
|
||||
import { ExternalSecretsConfig } from './configs/external-secrets';
|
||||
|
||||
@Config
|
||||
class UserManagementConfig {
|
||||
@@ -27,4 +28,7 @@ export class GlobalConfig {
|
||||
|
||||
@Nested
|
||||
publicApi: PublicApiConfig;
|
||||
|
||||
@Nested
|
||||
externalSecrets: ExternalSecretsConfig;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { License } from '@/License';
|
||||
import config from '@/config';
|
||||
import { GlobalConfig } from '@n8n/config';
|
||||
import Container from 'typedi';
|
||||
|
||||
export const updateIntervalTime = () => config.getEnv('externalSecrets.updateInterval') * 1000;
|
||||
export const preferGet = () => config.getEnv('externalSecrets.preferGet');
|
||||
export const updateIntervalTime = () =>
|
||||
Container.get(GlobalConfig).externalSecrets.updateInterval * 1000;
|
||||
export const preferGet = () => Container.get(GlobalConfig).externalSecrets.preferGet;
|
||||
|
||||
export function isExternalSecretsEnabled() {
|
||||
const license = Container.get(License);
|
||||
|
||||
@@ -763,21 +763,6 @@ export const schema = {
|
||||
},
|
||||
},
|
||||
|
||||
externalSecrets: {
|
||||
updateInterval: {
|
||||
format: Number,
|
||||
default: 300,
|
||||
env: 'N8N_EXTERNAL_SECRETS_UPDATE_INTERVAL',
|
||||
doc: 'How often (in seconds) to check for secret updates.',
|
||||
},
|
||||
preferGet: {
|
||||
format: Boolean,
|
||||
default: false,
|
||||
env: 'N8N_EXTERNAL_SECRETS_PREFER_GET',
|
||||
doc: 'Whether to prefer GET over LIST when fetching secrets from Hashicorp Vault.',
|
||||
},
|
||||
},
|
||||
|
||||
deployment: {
|
||||
type: {
|
||||
format: String,
|
||||
|
||||
Reference in New Issue
Block a user