From b678998801d1a184ee2ef484572bc4bbc82d1b45 Mon Sep 17 00:00:00 2001 From: willyp713 Date: Sun, 29 May 2022 07:18:57 -0500 Subject: [PATCH 1/2] Feature/add-redis-password (#947) * Expose REDIS_PASSWORD --- .env | 1 + apps/api/src/app/app.module.ts | 3 ++- apps/api/src/app/redis-cache/redis-cache.module.ts | 1 + apps/api/src/services/configuration.service.ts | 1 + apps/api/src/services/interfaces/environment.interface.ts | 1 + docker/docker-compose.build.yml | 1 + docker/docker-compose.yml | 1 + 7 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.env b/.env index e96c8b6b2..3b1b28877 100644 --- a/.env +++ b/.env @@ -3,6 +3,7 @@ COMPOSE_PROJECT_NAME=ghostfolio-development # CACHE REDIS_HOST=localhost REDIS_PORT=6379 +REDIS_PASSWORD=password # POSTGRES POSTGRES_DB=ghostfolio-db diff --git a/apps/api/src/app/app.module.ts b/apps/api/src/app/app.module.ts index f95c93fd2..f1fc27976 100644 --- a/apps/api/src/app/app.module.ts +++ b/apps/api/src/app/app.module.ts @@ -42,7 +42,8 @@ import { UserModule } from './user/user.module'; BullModule.forRoot({ redis: { host: process.env.REDIS_HOST, - port: parseInt(process.env.REDIS_PORT, 10) + port: parseInt(process.env.REDIS_PORT, 10), + password: process.env.REDIS_PASSWORD } }), CacheModule, diff --git a/apps/api/src/app/redis-cache/redis-cache.module.ts b/apps/api/src/app/redis-cache/redis-cache.module.ts index dcda94041..05fa7bf88 100644 --- a/apps/api/src/app/redis-cache/redis-cache.module.ts +++ b/apps/api/src/app/redis-cache/redis-cache.module.ts @@ -15,6 +15,7 @@ import { RedisCacheService } from './redis-cache.service'; host: configurationService.get('REDIS_HOST'), max: configurationService.get('MAX_ITEM_IN_CACHE'), port: configurationService.get('REDIS_PORT'), + password: configurationService.get('REDIS_PASSWORD'), store: redisStore, ttl: configurationService.get('CACHE_TTL') }) diff --git a/apps/api/src/services/configuration.service.ts b/apps/api/src/services/configuration.service.ts index e405884f5..5b471686f 100644 --- a/apps/api/src/services/configuration.service.ts +++ b/apps/api/src/services/configuration.service.ts @@ -37,6 +37,7 @@ export class ConfigurationService { RAKUTEN_RAPID_API_KEY: str({ default: '' }), REDIS_HOST: str({ default: 'localhost' }), REDIS_PORT: port({ default: 6379 }), + REDIS_PASSWORD: str({ default: '' }), ROOT_URL: str({ default: 'http://localhost:4200' }), STRIPE_PUBLIC_KEY: str({ default: '' }), STRIPE_SECRET_KEY: str({ default: '' }), diff --git a/apps/api/src/services/interfaces/environment.interface.ts b/apps/api/src/services/interfaces/environment.interface.ts index c4cc8f754..ec363c0e1 100644 --- a/apps/api/src/services/interfaces/environment.interface.ts +++ b/apps/api/src/services/interfaces/environment.interface.ts @@ -28,6 +28,7 @@ export interface Environment extends CleanedEnvAccessors { RAKUTEN_RAPID_API_KEY: string; REDIS_HOST: string; REDIS_PORT: number; + REDIS_PASSWORD: string; ROOT_URL: string; STRIPE_PUBLIC_KEY: string; STRIPE_SECRET_KEY: string; diff --git a/docker/docker-compose.build.yml b/docker/docker-compose.build.yml index 1d2496f9b..37f63d8c8 100644 --- a/docker/docker-compose.build.yml +++ b/docker/docker-compose.build.yml @@ -7,6 +7,7 @@ services: environment: DATABASE_URL: postgresql://user:password@postgres:5432/ghostfolio-db?sslmode=prefer REDIS_HOST: 'redis' + REDIS_PASSWORD: ${REDIS_PASSWORD} ports: - 3333:3333 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 7afd19a19..786f62f55 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -7,6 +7,7 @@ services: environment: DATABASE_URL: postgresql://user:password@postgres:5432/ghostfolio-db?sslmode=prefer REDIS_HOST: 'redis' + REDIS_PASSWORD: ${REDIS_PASSWORD} ports: - 3333:3333 From 697e92f81837c0c3c43358bec90218f709b9baf1 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 29 May 2022 14:54:53 +0200 Subject: [PATCH 2/2] Feature/finalize exposing redis password env variable (#975) * Add hints * Update changelog --- .env | 8 ++++---- CHANGELOG.md | 6 ++++++ apps/api/src/app/redis-cache/redis-cache.module.ts | 2 +- apps/api/src/services/configuration.service.ts | 2 +- apps/api/src/services/interfaces/environment.interface.ts | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.env b/.env index 3b1b28877..44c1ec3a5 100644 --- a/.env +++ b/.env @@ -3,15 +3,15 @@ COMPOSE_PROJECT_NAME=ghostfolio-development # CACHE REDIS_HOST=localhost REDIS_PORT=6379 -REDIS_PASSWORD=password +REDIS_PASSWORD= # POSTGRES POSTGRES_DB=ghostfolio-db POSTGRES_USER=user -POSTGRES_PASSWORD=password +POSTGRES_PASSWORD= -ACCESS_TOKEN_SALT=GHOSTFOLIO +ACCESS_TOKEN_SALT= ALPHA_VANTAGE_API_KEY= DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}?sslmode=prefer -JWT_SECRET_KEY=123456 +JWT_SECRET_KEY= PORT=3333 diff --git a/CHANGELOG.md b/CHANGELOG.md index e72ff0763..dca00fbc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed + +- Exposed the environment variable `REDIS_PASSWORD` + ## 1.154.0 - 28.05.2022 ### Added diff --git a/apps/api/src/app/redis-cache/redis-cache.module.ts b/apps/api/src/app/redis-cache/redis-cache.module.ts index 05fa7bf88..96cf50325 100644 --- a/apps/api/src/app/redis-cache/redis-cache.module.ts +++ b/apps/api/src/app/redis-cache/redis-cache.module.ts @@ -14,8 +14,8 @@ import { RedisCacheService } from './redis-cache.service'; useFactory: async (configurationService: ConfigurationService) => ({ host: configurationService.get('REDIS_HOST'), max: configurationService.get('MAX_ITEM_IN_CACHE'), - port: configurationService.get('REDIS_PORT'), password: configurationService.get('REDIS_PASSWORD'), + port: configurationService.get('REDIS_PORT'), store: redisStore, ttl: configurationService.get('CACHE_TTL') }) diff --git a/apps/api/src/services/configuration.service.ts b/apps/api/src/services/configuration.service.ts index 5b471686f..9666e7ab7 100644 --- a/apps/api/src/services/configuration.service.ts +++ b/apps/api/src/services/configuration.service.ts @@ -36,8 +36,8 @@ export class ConfigurationService { PORT: port({ default: 3333 }), RAKUTEN_RAPID_API_KEY: str({ default: '' }), REDIS_HOST: str({ default: 'localhost' }), - REDIS_PORT: port({ default: 6379 }), REDIS_PASSWORD: str({ default: '' }), + REDIS_PORT: port({ default: 6379 }), ROOT_URL: str({ default: 'http://localhost:4200' }), STRIPE_PUBLIC_KEY: str({ default: '' }), STRIPE_SECRET_KEY: str({ default: '' }), diff --git a/apps/api/src/services/interfaces/environment.interface.ts b/apps/api/src/services/interfaces/environment.interface.ts index ec363c0e1..79db93f54 100644 --- a/apps/api/src/services/interfaces/environment.interface.ts +++ b/apps/api/src/services/interfaces/environment.interface.ts @@ -27,8 +27,8 @@ export interface Environment extends CleanedEnvAccessors { PORT: number; RAKUTEN_RAPID_API_KEY: string; REDIS_HOST: string; - REDIS_PORT: number; REDIS_PASSWORD: string; + REDIS_PORT: number; ROOT_URL: string; STRIPE_PUBLIC_KEY: string; STRIPE_SECRET_KEY: string;