rename core-module environment to twenty-config (#11445)
closes https://github.com/twentyhq/core-team-issues/issues/759
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
import { Global, Module } from '@nestjs/common';
|
||||
|
||||
import { EnvironmentModule } from 'src/engine/core-modules/environment/environment.module';
|
||||
import { RedisClientService } from 'src/engine/core-modules/redis-client/redis-client.service';
|
||||
import { TwentyConfigModule } from 'src/engine/core-modules/twenty-config/twenty-config.module';
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
imports: [EnvironmentModule],
|
||||
imports: [TwentyConfigModule],
|
||||
providers: [RedisClientService],
|
||||
exports: [RedisClientService],
|
||||
})
|
||||
|
||||
@ -2,17 +2,17 @@ import { Injectable, OnModuleDestroy } from '@nestjs/common';
|
||||
|
||||
import IORedis from 'ioredis';
|
||||
|
||||
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
||||
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
|
||||
|
||||
@Injectable()
|
||||
export class RedisClientService implements OnModuleDestroy {
|
||||
private redisClient: IORedis | null = null;
|
||||
|
||||
constructor(private readonly environmentService: EnvironmentService) {}
|
||||
constructor(private readonly twentyConfigService: TwentyConfigService) {}
|
||||
|
||||
getClient() {
|
||||
if (!this.redisClient) {
|
||||
const redisUrl = this.environmentService.get('REDIS_URL');
|
||||
const redisUrl = this.twentyConfigService.get('REDIS_URL');
|
||||
|
||||
if (!redisUrl) {
|
||||
throw new Error('REDIS_URL must be defined');
|
||||
|
||||
Reference in New Issue
Block a user