diff --git a/.env b/.env index 15d19eb9..85596413 100644 --- a/.env +++ b/.env @@ -15,3 +15,4 @@ ETHPLORER_API_KEY = "" CURRENCY = "" RUNTIME_ENVIRONMENT = "DEV" WEBHOOK_SECRET_TOKEN = "" +REDIS_PASSWORD = "" \ No newline at end of file diff --git a/bot.py b/bot.py index 0ab4fc35..fd2940ae 100644 --- a/bot.py +++ b/bot.py @@ -15,7 +15,7 @@ from fastapi.responses import JSONResponse from services.notification import NotificationService -redis = Redis() +redis = Redis(password=config.REDIS_PASSWORD) bot = Bot(TOKEN, default=DefaultBotProperties(parse_mode=ParseMode.HTML)) dp = Dispatcher(storage=RedisStorage(redis)) app = FastAPI() diff --git a/config.py b/config.py index c9346c37..0231005d 100644 --- a/config.py +++ b/config.py @@ -30,3 +30,4 @@ ETHPLORER_API_KEY = os.environ.get("ETHPLORER_API_KEY") CURRENCY = Currency(os.environ.get("CURRENCY")) WEBHOOK_SECRET_TOKEN = os.environ.get("WEBHOOK_SECRET_TOKEN") +REDIS_PASSWORD = os.environ.get("REDIS_PASSWORD") diff --git a/docker-compose.yml b/docker-compose.yml index 29fabfe0..3ea8a825 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -57,8 +57,14 @@ services: redis: image: redis:latest container_name: redis + command: + - /bin/sh + - -c + - redis-server --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}" ports: - "6379:6379" + env_file: + - .env volumes: - redis_data:/data restart: always