refactor(core): Port workflows config (no-changelog) (#10173)

This commit is contained in:
Iván Ovejero
2024-07-24 14:38:29 +02:00
committed by GitHub
parent 9056242b3a
commit b81f0bf9ea
8 changed files with 48 additions and 28 deletions

View File

@@ -0,0 +1,20 @@
import { Config, Env } from '../decorators';
@Config
export class WorkflowsConfig {
/** Default name for workflow */
@Env('WORKFLOWS_DEFAULT_NAME')
readonly defaultName: string = 'My workflow';
/** Show onboarding flow in new workflow */
@Env('N8N_ONBOARDING_FLOW_DISABLED')
readonly onboardingFlowDisabled: boolean = false;
/** Default option for which workflows may call the current workflow */
@Env('N8N_WORKFLOW_CALLER_POLICY_DEFAULT_OPTION')
readonly callerPolicyDefaultOption:
| 'any'
| 'none'
| 'workflowsFromAList'
| 'workflowsFromSameOwner' = 'workflowsFromSameOwner';
}

View File

@@ -9,6 +9,7 @@ import { TemplatesConfig } from './configs/templates';
import { EventBusConfig } from './configs/event-bus';
import { NodesConfig } from './configs/nodes';
import { ExternalStorageConfig } from './configs/external-storage';
import { WorkflowsConfig } from './configs/workflows';
@Config
class UserManagementConfig {
@@ -47,4 +48,7 @@ export class GlobalConfig {
@Nested
readonly externalStorage: ExternalStorageConfig;
@Nested
readonly workflows: WorkflowsConfig;
}

View File

@@ -135,6 +135,11 @@ describe('GlobalConfig', () => {
},
},
},
workflows: {
defaultName: 'My workflow',
onboardingFlowDisabled: false,
callerPolicyDefaultOption: 'workflowsFromSameOwner',
},
};
it('should use all default values when no env variables are defined', () => {