feat: soft disable LOCAL code interpreter driver in production (#16647)
## Summary Instead of throwing an error at server startup when LOCAL code interpreter is configured in production, we now return a DisabledDriver that only throws when the code interpreter is actually used. ## Changes - Created `DisabledDriver` class that implements `CodeInterpreterDriver` but throws an error only when `execute()` is called - Added `DISABLED` to the `CodeInterpreterDriverType` enum - Updated the factory to return a `DISABLED` driver config instead of throwing when LOCAL is used in production - Updated the module to handle the new `DISABLED` driver type ## Motivation Many users don't need the code interpreter feature and want to deploy to production without configuring E2B. Previously, the server would crash at startup if `CODE_INTERPRETER_TYPE=LOCAL` was set in production. **Before:** Server crashes at startup in production if `CODE_INTERPRETER_TYPE=LOCAL` **After:** Server starts fine. The error only occurs if someone actually tries to **use** the code interpreter feature, at which point they get a clear error message explaining how to configure E2B.
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
} from 'class-validator';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { AwsRegion } from 'src/engine/core-modules/twenty-config/interfaces/aws-region.interface';
|
||||
import { type AwsRegion } from 'src/engine/core-modules/twenty-config/interfaces/aws-region.interface';
|
||||
import { NodeEnvironment } from 'src/engine/core-modules/twenty-config/interfaces/node-environment.interface';
|
||||
import { SupportDriver } from 'src/engine/core-modules/twenty-config/interfaces/support.interface';
|
||||
|
||||
@@ -537,7 +537,7 @@ export class ConfigVariables {
|
||||
@IsOptional()
|
||||
@CastToUpperSnakeCase()
|
||||
CODE_INTERPRETER_TYPE: CodeInterpreterDriverType =
|
||||
CodeInterpreterDriverType.LOCAL;
|
||||
CodeInterpreterDriverType.DISABLED;
|
||||
|
||||
@ConfigVariablesMetadata({
|
||||
group: ConfigVariablesGroup.CODE_INTERPRETER_CONFIG,
|
||||
|
||||
Reference in New Issue
Block a user