mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(core): Port external storage config (no-changelog) (#10169)
This commit is contained in:
42
packages/@n8n/config/src/configs/external-storage.ts
Normal file
42
packages/@n8n/config/src/configs/external-storage.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { Config, Env, Nested } from '../decorators';
|
||||
|
||||
@Config
|
||||
class S3BucketConfig {
|
||||
/** Name of the n8n bucket in S3-compatible external storage */
|
||||
@Env('N8N_EXTERNAL_STORAGE_S3_BUCKET_NAME')
|
||||
readonly name: string = '';
|
||||
|
||||
/** Region of the n8n bucket in S3-compatible external storage @example "us-east-1" */
|
||||
@Env('N8N_EXTERNAL_STORAGE_S3_BUCKET_REGION')
|
||||
readonly region: string = '';
|
||||
}
|
||||
|
||||
@Config
|
||||
class S3CredentialsConfig {
|
||||
/** Access key in S3-compatible external storage */
|
||||
@Env('N8N_EXTERNAL_STORAGE_S3_ACCESS_KEY')
|
||||
readonly accessKey: string = '';
|
||||
|
||||
/** Access secret in S3-compatible external storage */
|
||||
@Env('N8N_EXTERNAL_STORAGE_S3_ACCESS_SECRET')
|
||||
readonly accessSecret: string = '';
|
||||
}
|
||||
|
||||
@Config
|
||||
class S3Config {
|
||||
/** Host of the n8n bucket in S3-compatible external storage @example "s3.us-east-1.amazonaws.com" */
|
||||
@Env('N8N_EXTERNAL_STORAGE_S3_HOST')
|
||||
readonly host: string = '';
|
||||
|
||||
@Nested
|
||||
readonly bucket: S3BucketConfig;
|
||||
|
||||
@Nested
|
||||
readonly credentials: S3CredentialsConfig;
|
||||
}
|
||||
|
||||
@Config
|
||||
export class ExternalStorageConfig {
|
||||
@Nested
|
||||
readonly s3: S3Config;
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import { ExternalSecretsConfig } from './configs/external-secrets';
|
||||
import { TemplatesConfig } from './configs/templates';
|
||||
import { EventBusConfig } from './configs/event-bus';
|
||||
import { NodesConfig } from './configs/nodes';
|
||||
import { ExternalStorageConfig } from './configs/external-storage';
|
||||
|
||||
@Config
|
||||
class UserManagementConfig {
|
||||
@@ -18,29 +19,32 @@ class UserManagementConfig {
|
||||
@Config
|
||||
export class GlobalConfig {
|
||||
@Nested
|
||||
database: DatabaseConfig;
|
||||
readonly database: DatabaseConfig;
|
||||
|
||||
@Nested
|
||||
credentials: CredentialsConfig;
|
||||
readonly credentials: CredentialsConfig;
|
||||
|
||||
@Nested
|
||||
userManagement: UserManagementConfig;
|
||||
readonly userManagement: UserManagementConfig;
|
||||
|
||||
@Nested
|
||||
versionNotifications: VersionNotificationsConfig;
|
||||
readonly versionNotifications: VersionNotificationsConfig;
|
||||
|
||||
@Nested
|
||||
publicApi: PublicApiConfig;
|
||||
readonly publicApi: PublicApiConfig;
|
||||
|
||||
@Nested
|
||||
externalSecrets: ExternalSecretsConfig;
|
||||
readonly externalSecrets: ExternalSecretsConfig;
|
||||
|
||||
@Nested
|
||||
templates: TemplatesConfig;
|
||||
readonly templates: TemplatesConfig;
|
||||
|
||||
@Nested
|
||||
eventBus: EventBusConfig;
|
||||
readonly eventBus: EventBusConfig;
|
||||
|
||||
@Nested
|
||||
readonly nodes: NodesConfig;
|
||||
|
||||
@Nested
|
||||
readonly externalStorage: ExternalStorageConfig;
|
||||
}
|
||||
|
||||
@@ -122,6 +122,19 @@ describe('GlobalConfig', () => {
|
||||
endpoint: 'https://api.n8n.io/api/versions/',
|
||||
infoUrl: 'https://docs.n8n.io/hosting/installation/updating/',
|
||||
},
|
||||
externalStorage: {
|
||||
s3: {
|
||||
host: '',
|
||||
bucket: {
|
||||
name: '',
|
||||
region: '',
|
||||
},
|
||||
credentials: {
|
||||
accessKey: '',
|
||||
accessSecret: '',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
it('should use all default values when no env variables are defined', () => {
|
||||
|
||||
Reference in New Issue
Block a user