rename core-module environment to twenty-config (#11445)

closes https://github.com/twentyhq/core-team-issues/issues/759
This commit is contained in:
nitin
2025-04-09 17:41:26 +05:30
committed by GitHub
parent fe6d0241a8
commit bd3ec6d5e3
193 changed files with 1454 additions and 1422 deletions

View File

@ -1,22 +1,22 @@
import { HttpAdapterHost } from '@nestjs/core';
import { NodeEnvironment } from 'src/engine/core-modules/environment/interfaces/node-environment.interface';
import { NodeEnvironment } from 'src/engine/core-modules/twenty-config/interfaces/node-environment.interface';
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
import { OPTIONS_TYPE } from 'src/engine/core-modules/exception-handler/exception-handler.module-definition';
import { ExceptionHandlerDriver } from 'src/engine/core-modules/exception-handler/interfaces';
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
/**
* ExceptionHandler Module factory
* @returns ExceptionHandlerModuleOptions
* @param environmentService
* @param twentyConfigService
* @param adapterHost
*/
export const exceptionHandlerModuleFactory = async (
environmentService: EnvironmentService,
twentyConfigService: TwentyConfigService,
adapterHost: HttpAdapterHost,
): Promise<typeof OPTIONS_TYPE> => {
const driverType = environmentService.get('EXCEPTION_HANDLER_DRIVER');
const driverType = twentyConfigService.get('EXCEPTION_HANDLER_DRIVER');
switch (driverType) {
case ExceptionHandlerDriver.Console: {
@ -28,12 +28,12 @@ export const exceptionHandlerModuleFactory = async (
return {
type: ExceptionHandlerDriver.Sentry,
options: {
environment: environmentService.get('SENTRY_ENVIRONMENT'),
release: environmentService.get('SENTRY_RELEASE'),
dsn: environmentService.get('SENTRY_DSN') ?? '',
environment: twentyConfigService.get('SENTRY_ENVIRONMENT'),
release: twentyConfigService.get('SENTRY_RELEASE'),
dsn: twentyConfigService.get('SENTRY_DSN') ?? '',
serverInstance: adapterHost.httpAdapter?.getInstance(),
debug:
environmentService.get('NODE_ENV') === NodeEnvironment.development,
twentyConfigService.get('NODE_ENV') === NodeEnvironment.development,
},
};
}