diff --git a/packages/twenty-docker/twenty/Dockerfile b/packages/twenty-docker/twenty/Dockerfile index c1a59904fe..d2f4b4a6b5 100644 --- a/packages/twenty-docker/twenty/Dockerfile +++ b/packages/twenty-docker/twenty/Dockerfile @@ -215,7 +215,8 @@ ENV PG_DATABASE_URL=postgres://twenty:twenty@localhost:5432/default \ DISABLE_DB_MIGRATIONS=true \ DISABLE_CRON_JOBS_REGISTRATION=true \ IS_BILLING_ENABLED=false \ - SIGN_IN_PREFILLED=true + SIGN_IN_PREFILLED=true \ + APPLICATION_LOG_DRIVER=CONSOLE EXPOSE 2020 VOLUME ["/data/postgres", "/app/packages/twenty-server/.local-storage"] diff --git a/packages/twenty-server/.env.example b/packages/twenty-server/.env.example index 28d26d345d..2a034c41c9 100644 --- a/packages/twenty-server/.env.example +++ b/packages/twenty-server/.env.example @@ -48,6 +48,7 @@ FRONTEND_URL=http://localhost:3001 # SENTRY_ENVIRONMENT=main # SENTRY_DSN=https://xxx@xxx.ingest.sentry.io/xxx # SENTRY_FRONT_DSN=https://xxx@xxx.ingest.sentry.io/xxx +# APPLICATION_LOG_DRIVER=CONSOLE # LOG_LEVELS=error,warn # SERVER_URL=http://localhost:3000 # WORKSPACE_INACTIVE_DAYS_BEFORE_NOTIFICATION=7 diff --git a/packages/twenty-server/src/engine/core-modules/application-logs/application-logs.module-factory.ts b/packages/twenty-server/src/engine/core-modules/application-logs/application-logs.module-factory.ts index f25a971ea4..c687992882 100644 --- a/packages/twenty-server/src/engine/core-modules/application-logs/application-logs.module-factory.ts +++ b/packages/twenty-server/src/engine/core-modules/application-logs/application-logs.module-factory.ts @@ -1,14 +1,14 @@ import { type TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service'; import { type OPTIONS_TYPE } from 'src/engine/core-modules/application-logs/application-logs.module-definition'; -import { ApplicationLogDriverType } from 'src/engine/core-modules/application-logs/interfaces/application-log-driver-type.enum'; +import { ApplicationLogDriver } from 'src/engine/core-modules/application-logs/interfaces/application-log-driver.enum'; export const applicationLogsModuleFactory = async ( twentyConfigService: TwentyConfigService, ): Promise => { - const driverType = twentyConfigService.get('APPLICATION_LOG_DRIVER_TYPE'); + const driverType = twentyConfigService.get('APPLICATION_LOG_DRIVER'); return { - type: driverType as ApplicationLogDriverType, + type: driverType as ApplicationLogDriver, }; }; diff --git a/packages/twenty-server/src/engine/core-modules/application-logs/application-logs.module.ts b/packages/twenty-server/src/engine/core-modules/application-logs/application-logs.module.ts index b554d7c246..3daeefa31e 100644 --- a/packages/twenty-server/src/engine/core-modules/application-logs/application-logs.module.ts +++ b/packages/twenty-server/src/engine/core-modules/application-logs/application-logs.module.ts @@ -12,7 +12,7 @@ import { ApplicationLogsService } from 'src/engine/core-modules/application-logs import { ClickHouseApplicationLogDriver } from 'src/engine/core-modules/application-logs/drivers/clickhouse.driver'; import { ConsoleApplicationLogDriver } from 'src/engine/core-modules/application-logs/drivers/console.driver'; import { DisabledApplicationLogDriver } from 'src/engine/core-modules/application-logs/drivers/disabled.driver'; -import { ApplicationLogDriverType } from 'src/engine/core-modules/application-logs/interfaces/application-log-driver-type.enum'; +import { ApplicationLogDriver } from 'src/engine/core-modules/application-logs/interfaces/application-log-driver.enum'; @Global() @Module({ @@ -64,13 +64,13 @@ export class ApplicationLogsModule extends ConfigurableModuleClass { } private static createDriver( - type: ApplicationLogDriverType, + type: ApplicationLogDriver, clickHouseService?: ClickHouseService, ) { switch (type) { - case ApplicationLogDriverType.CONSOLE: + case ApplicationLogDriver.CONSOLE: return new ConsoleApplicationLogDriver(); - case ApplicationLogDriverType.CLICKHOUSE: + case ApplicationLogDriver.CLICKHOUSE: if (!clickHouseService) { throw new Error( 'ClickHouseService is required for the ClickHouse application log driver', @@ -78,7 +78,7 @@ export class ApplicationLogsModule extends ConfigurableModuleClass { } return new ClickHouseApplicationLogDriver(clickHouseService); - case ApplicationLogDriverType.DISABLED: + case ApplicationLogDriver.DISABLED: default: return new DisabledApplicationLogDriver(); } diff --git a/packages/twenty-server/src/engine/core-modules/application-logs/interfaces/application-log-driver-type.enum.ts b/packages/twenty-server/src/engine/core-modules/application-logs/interfaces/application-log-driver.enum.ts similarity index 66% rename from packages/twenty-server/src/engine/core-modules/application-logs/interfaces/application-log-driver-type.enum.ts rename to packages/twenty-server/src/engine/core-modules/application-logs/interfaces/application-log-driver.enum.ts index a223c2d564..b5283aed3f 100644 --- a/packages/twenty-server/src/engine/core-modules/application-logs/interfaces/application-log-driver-type.enum.ts +++ b/packages/twenty-server/src/engine/core-modules/application-logs/interfaces/application-log-driver.enum.ts @@ -1,4 +1,4 @@ -export enum ApplicationLogDriverType { +export enum ApplicationLogDriver { DISABLED = 'DISABLED', CONSOLE = 'CONSOLE', CLICKHOUSE = 'CLICKHOUSE', diff --git a/packages/twenty-server/src/engine/core-modules/application-logs/interfaces/application-logs-module-options.type.ts b/packages/twenty-server/src/engine/core-modules/application-logs/interfaces/application-logs-module-options.type.ts index 838741fdd1..eb569cf084 100644 --- a/packages/twenty-server/src/engine/core-modules/application-logs/interfaces/application-logs-module-options.type.ts +++ b/packages/twenty-server/src/engine/core-modules/application-logs/interfaces/application-logs-module-options.type.ts @@ -1,5 +1,5 @@ -import { type ApplicationLogDriverType } from 'src/engine/core-modules/application-logs/interfaces/application-log-driver-type.enum'; +import { type ApplicationLogDriver } from 'src/engine/core-modules/application-logs/interfaces/application-log-driver.enum'; export type ApplicationLogsModuleOptions = { - type: ApplicationLogDriverType; + type: ApplicationLogDriver; }; diff --git a/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts b/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts index bb64c8acd0..3b62dcf6a0 100644 --- a/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts +++ b/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts @@ -17,7 +17,7 @@ import { type AwsRegion } from 'src/engine/core-modules/twenty-config/interfaces 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'; -import { ApplicationLogDriverType } from 'src/engine/core-modules/application-logs/interfaces/application-log-driver-type.enum'; +import { ApplicationLogDriver } from 'src/engine/core-modules/application-logs/interfaces/application-log-driver.enum'; import { CaptchaDriverType } from 'src/engine/core-modules/captcha/interfaces'; import { CodeInterpreterDriverType } from 'src/engine/core-modules/code-interpreter/code-interpreter.interface'; import { WebSearchDriverType } from 'src/engine/core-modules/web-search/web-search.interface'; @@ -932,13 +932,12 @@ export class ConfigVariables { description: 'Driver used for application logs (Disabled, Console, or ClickHouse)', type: ConfigVariableType.ENUM, - options: Object.values(ApplicationLogDriverType), + options: Object.values(ApplicationLogDriver), isEnvOnly: true, }) @IsOptional() @CastToUpperSnakeCase() - APPLICATION_LOG_DRIVER_TYPE: ApplicationLogDriverType = - ApplicationLogDriverType.DISABLED; + APPLICATION_LOG_DRIVER: ApplicationLogDriver = ApplicationLogDriver.DISABLED; @ConfigVariablesMetadata({ group: ConfigVariablesGroup.SUPPORT_CHAT_CONFIG,