refactor(core): Port external storage config (no-changelog) (#10169)
This commit is contained in:
@@ -44,6 +44,8 @@ export abstract class BaseCommand extends Command {
|
||||
|
||||
protected license: License;
|
||||
|
||||
private globalConfig = Container.get(GlobalConfig);
|
||||
|
||||
/**
|
||||
* How long to wait for graceful shutdown before force killing the process.
|
||||
*/
|
||||
@@ -79,8 +81,7 @@ export abstract class BaseCommand extends Command {
|
||||
await this.exitWithCrash('There was an error running database migrations', error),
|
||||
);
|
||||
|
||||
const globalConfig = Container.get(GlobalConfig);
|
||||
const { type: dbType } = globalConfig.database;
|
||||
const { type: dbType } = this.globalConfig.database;
|
||||
|
||||
if (['mysqldb', 'mariadb'].includes(dbType)) {
|
||||
this.logger.warn(
|
||||
@@ -199,7 +200,7 @@ export abstract class BaseCommand extends Command {
|
||||
private async _initObjectStoreService(options = { isReadOnly: false }) {
|
||||
const objectStoreService = Container.get(ObjectStoreService);
|
||||
|
||||
const host = config.getEnv('externalStorage.s3.host');
|
||||
const { host, bucket, credentials } = this.globalConfig.externalStorage.s3;
|
||||
|
||||
if (host === '') {
|
||||
throw new ApplicationError(
|
||||
@@ -207,11 +208,6 @@ export abstract class BaseCommand extends Command {
|
||||
);
|
||||
}
|
||||
|
||||
const bucket = {
|
||||
name: config.getEnv('externalStorage.s3.bucket.name'),
|
||||
region: config.getEnv('externalStorage.s3.bucket.region'),
|
||||
};
|
||||
|
||||
if (bucket.name === '') {
|
||||
throw new ApplicationError(
|
||||
'External storage bucket name not configured. Please set `N8N_EXTERNAL_STORAGE_S3_BUCKET_NAME`.',
|
||||
@@ -224,11 +220,6 @@ export abstract class BaseCommand extends Command {
|
||||
);
|
||||
}
|
||||
|
||||
const credentials = {
|
||||
accessKey: config.getEnv('externalStorage.s3.credentials.accessKey'),
|
||||
accessSecret: config.getEnv('externalStorage.s3.credentials.accessSecret'),
|
||||
};
|
||||
|
||||
if (credentials.accessKey === '') {
|
||||
throw new ApplicationError(
|
||||
'External storage access key not configured. Please set `N8N_EXTERNAL_STORAGE_S3_ACCESS_KEY`.',
|
||||
|
||||
@@ -671,45 +671,6 @@ export const schema = {
|
||||
},
|
||||
},
|
||||
|
||||
externalStorage: {
|
||||
s3: {
|
||||
host: {
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'N8N_EXTERNAL_STORAGE_S3_HOST',
|
||||
doc: 'Host of the n8n bucket in S3-compatible external storage, e.g. `s3.us-east-1.amazonaws.com`',
|
||||
},
|
||||
bucket: {
|
||||
name: {
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'N8N_EXTERNAL_STORAGE_S3_BUCKET_NAME',
|
||||
doc: 'Name of the n8n bucket in S3-compatible external storage',
|
||||
},
|
||||
region: {
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'N8N_EXTERNAL_STORAGE_S3_BUCKET_REGION',
|
||||
doc: 'Region of the n8n bucket in S3-compatible external storage, e.g. `us-east-1`',
|
||||
},
|
||||
},
|
||||
credentials: {
|
||||
accessKey: {
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'N8N_EXTERNAL_STORAGE_S3_ACCESS_KEY',
|
||||
doc: 'Access key in S3-compatible external storage',
|
||||
},
|
||||
accessSecret: {
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'N8N_EXTERNAL_STORAGE_S3_ACCESS_SECRET',
|
||||
doc: 'Access secret in S3-compatible external storage',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
deployment: {
|
||||
type: {
|
||||
format: String,
|
||||
|
||||
Reference in New Issue
Block a user