fix: environment variables (#1490)

This commit is contained in:
chenos 2023-02-23 21:09:20 +08:00 committed by GitHub
parent 856b6efa77
commit b91937552c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,44 +3,52 @@ import _ from 'lodash';
import path from 'path'; import path from 'path';
export class PresetNocoBase extends Plugin { export class PresetNocoBase extends Plugin {
builtInPlugins = [
'error-handler',
'collection-manager',
'ui-schema-storage',
'ui-routes-storage',
'file-manager',
'system-settings',
'sequence-field',
'verification',
'users',
'acl',
'china-region',
'workflow',
'client',
'export',
'import',
'audit-logs',
'duplicator',
'iframe-block',
'formula-field',
];
localPlugins = [
'sample-hello',
'multi-app-manager',
'oidc',
'saml',
'map',
'snapshot-field',
'graph-collection-manager',
];
splitNames(name: string) {
return (name || '').split(',').filter(Boolean);
}
getBuiltInPlugins() { getBuiltInPlugins() {
const plugins = (process.env.PRESET_NOCOBASE_PLUGINS || '').split(',').filter(Boolean); const { PRESET_NOCOBASE_PLUGINS, APPEND_PRESET_BUILT_IN_PLUGINS } = process.env;
return _.uniq( return _.uniq(
[ this.splitNames(APPEND_PRESET_BUILT_IN_PLUGINS || PRESET_NOCOBASE_PLUGINS).concat(this.builtInPlugins),
'error-handler',
'collection-manager',
'ui-schema-storage',
'ui-routes-storage',
'file-manager',
'system-settings',
'sequence-field',
'verification',
'users',
'acl',
'china-region',
'workflow',
'client',
'export',
'import',
'audit-logs',
'duplicator',
'iframe-block',
'formula-field',
].concat(plugins),
); );
} }
getLocalPlugins() { getLocalPlugins() {
const localPlugins = [ const { APPEND_PRESET_LOCAL_PLUGINS } = process.env;
'sample-hello', return _.uniq(this.splitNames(APPEND_PRESET_LOCAL_PLUGINS).concat(this.localPlugins));
'multi-app-manager',
'oidc',
'saml',
'map',
'snapshot-field',
'graph-collection-manager',
];
return localPlugins;
} }
async addBuiltInPlugins(options?: any) { async addBuiltInPlugins(options?: any) {