Browse Source
			
			
			Feature/expose redis database via environment variable (#3036)
			
				* Expose Redis database via environment variable
* Update changelog
			
			
				pull/3041/head^2
			
			
		 
		
			
				
					
						 miles
					
					2 years ago
						miles
					
					2 years ago
					
						
							committed by
							
								 GitHub
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: B5690EEEBB952194
						
					
				
			
		
		
		
	
		
			
				 6 changed files with 
6 additions and 
0 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
- 
					
					
					 
					README.md
				
- 
					
					
					 
					apps/api/src/app/app.module.ts
				
- 
					
					
					 
					apps/api/src/app/redis-cache/redis-cache.module.ts
				
- 
					
					
					 
					apps/api/src/services/configuration/configuration.service.ts
				
- 
					
					
					 
					apps/api/src/services/interfaces/environment.interface.ts
				
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | ### Changed | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | - Exposed the database index of _Redis_ as an environment variable (`REDIS_DB`) | 
			
		
	
		
			
				
					|  |  |  | - Upgraded `prisma` from version `5.9.1` to `5.10.2` | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | ## 2.55.0 - 2024-02-22 | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -99,6 +99,7 @@ We provide official container images hosted on [Docker Hub](https://hub.docker.c | 
			
		
	
		
			
				
					|  |  |  | | `POSTGRES_DB`            |               | The name of the _PostgreSQL_ database                                                                                               | | 
			
		
	
		
			
				
					|  |  |  | | `POSTGRES_PASSWORD`      |               | The password of the _PostgreSQL_ database                                                                                           | | 
			
		
	
		
			
				
					|  |  |  | | `POSTGRES_USER`          |               | The user of the _PostgreSQL_ database                                                                                               | | 
			
		
	
		
			
				
					|  |  |  | | `REDIS_DB`               | `0`           | The database index of _Redis_                                                                                                       | | 
			
		
	
		
			
				
					|  |  |  | | `REDIS_HOST`             |               | The host where _Redis_ is running                                                                                                   | | 
			
		
	
		
			
				
					|  |  |  | | `REDIS_PASSWORD`         |               | The password of _Redis_                                                                                                             | | 
			
		
	
		
			
				
					|  |  |  | | `REDIS_PORT`             |               | The port where _Redis_ is running                                                                                                   | | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -53,6 +53,7 @@ import { UserModule } from './user/user.module'; | 
			
		
	
		
			
				
					|  |  |  |     BenchmarkModule, | 
			
		
	
		
			
				
					|  |  |  |     BullModule.forRoot({ | 
			
		
	
		
			
				
					|  |  |  |       redis: { | 
			
		
	
		
			
				
					|  |  |  |         db: parseInt(process.env.REDIS_DB ?? '0', 10), | 
			
		
	
		
			
				
					|  |  |  |         host: process.env.REDIS_HOST, | 
			
		
	
		
			
				
					|  |  |  |         port: parseInt(process.env.REDIS_PORT ?? '6379', 10), | 
			
		
	
		
			
				
					|  |  |  |         password: process.env.REDIS_PASSWORD | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -15,6 +15,7 @@ import { RedisCacheService } from './redis-cache.service'; | 
			
		
	
		
			
				
					|  |  |  |       inject: [ConfigurationService], | 
			
		
	
		
			
				
					|  |  |  |       useFactory: async (configurationService: ConfigurationService) => { | 
			
		
	
		
			
				
					|  |  |  |         return <RedisClientOptions>{ | 
			
		
	
		
			
				
					|  |  |  |           db: configurationService.get('REDIS_DB'), | 
			
		
	
		
			
				
					|  |  |  |           host: configurationService.get('REDIS_HOST'), | 
			
		
	
		
			
				
					|  |  |  |           max: configurationService.get('MAX_ITEM_IN_CACHE'), | 
			
		
	
		
			
				
					|  |  |  |           password: configurationService.get('REDIS_PASSWORD'), | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -43,6 +43,7 @@ export class ConfigurationService { | 
			
		
	
		
			
				
					|  |  |  |       MAX_ACTIVITIES_TO_IMPORT: num({ default: Number.MAX_SAFE_INTEGER }), | 
			
		
	
		
			
				
					|  |  |  |       MAX_ITEM_IN_CACHE: num({ default: 9999 }), | 
			
		
	
		
			
				
					|  |  |  |       PORT: port({ default: 3333 }), | 
			
		
	
		
			
				
					|  |  |  |       REDIS_DB: num({ default: 0 }), | 
			
		
	
		
			
				
					|  |  |  |       REDIS_HOST: str({ default: 'localhost' }), | 
			
		
	
		
			
				
					|  |  |  |       REDIS_PASSWORD: str({ default: '' }), | 
			
		
	
		
			
				
					|  |  |  |       REDIS_PORT: port({ default: 6379 }), | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -30,6 +30,7 @@ export interface Environment extends CleanedEnvAccessors { | 
			
		
	
		
			
				
					|  |  |  |   MAX_ACTIVITIES_TO_IMPORT: number; | 
			
		
	
		
			
				
					|  |  |  |   MAX_ITEM_IN_CACHE: number; | 
			
		
	
		
			
				
					|  |  |  |   PORT: number; | 
			
		
	
		
			
				
					|  |  |  |   REDIS_DB: number; | 
			
		
	
		
			
				
					|  |  |  |   REDIS_HOST: string; | 
			
		
	
		
			
				
					|  |  |  |   REDIS_PASSWORD: string; | 
			
		
	
		
			
				
					|  |  |  |   REDIS_PORT: number; | 
			
		
	
	
		
			
				
					|  |  | 
 |