Skip to content

Commit

Permalink
[ENH] Configuration update + Redis
Browse files Browse the repository at this point in the history
  • Loading branch information
dragarthPl committed Apr 5, 2024
1 parent 8500abf commit af2358a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion config/configuration.yaml
Original file line number Diff line number Diff line change
@@ -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
default_minimum_temperature: 15

features:
file_logging: false
demo_mode: false
3 changes: 3 additions & 0 deletions src/main/core/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down
4 changes: 4 additions & 0 deletions src/main/core/container.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]

0 comments on commit af2358a

Please sign in to comment.