diff --git a/config/configuration.yaml b/config/configuration.yaml index 7c72e5a..89c41a5 100644 --- a/config/configuration.yaml +++ b/config/configuration.yaml @@ -1,5 +1,11 @@ stream_ip: 192.168.1.236 stream_port: 9801 +redis_ip: localhost +redis_port: 6379 default_maximum_temperature: 80 -default_minimum_temperature: 15 \ No newline at end of file +default_minimum_temperature: 15 + +features: + file_logging: false + demo_mode: false \ No newline at end of file diff --git a/src/main/core/configuration.py b/src/main/core/configuration.py index 4a5ff0d..fd9b2ab 100644 --- a/src/main/core/configuration.py +++ b/src/main/core/configuration.py @@ -21,6 +21,9 @@ class Configuration(BaseSettings): stream_ip: str = yaml_configuration['stream_ip'] stream_port: int = yaml_configuration['stream_port'] + redis_ip: str = yaml_configuration['redis_ip'] + redis_port: int = yaml_configuration['redis_port'] + default_maximum_temperature: int = yaml_configuration['default_maximum_temperature'] default_minimum_temperature: int = yaml_configuration['default_minimum_temperature'] diff --git a/src/main/core/container.py b/src/main/core/container.py index cb45e67..1eaf84f 100644 --- a/src/main/core/container.py +++ b/src/main/core/container.py @@ -1,5 +1,7 @@ +from redis import Redis from injector import Binder +from main.core.configuration import Configuration from main.stove_state.stove_state_repository import StoveStateRepository, IStoveStateRepository from main.temperature.heating_temperature_repository import IHeatingTemperatureRepository, HeatingTemperatureRepository from main.temperature.mixer_temperature_repository import IMixerTemperatureRepository, MixerTemperatureRepository @@ -8,7 +10,9 @@ def container(binder: Binder) -> None: + configuration = Configuration() binder.bind(IMixerTemperatureRepository, to=MixerTemperatureRepository) # type: ignore[type-abstract] binder.bind(IWaterHeaterTemperatureRepository, to=WaterHeaterTemperatureRepository) # type: ignore[type-abstract] binder.bind(IHeatingTemperatureRepository, to=HeatingTemperatureRepository) # type: ignore[type-abstract] binder.bind(IStoveStateRepository, to=StoveStateRepository) # type: ignore[type-abstract] + binder.bind(Redis, to=Redis(host=configuration.redis_ip, port=configuration.redis_port, decode_responses=True)) # type: ignore[type-abstract]