rename core-module environment to twenty-config (#11445)
closes https://github.com/twentyhq/core-team-issues/issues/759
This commit is contained in:
@ -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,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user