diff --git a/.env.example b/.env.example index fda5bae..bc57a86 100644 --- a/.env.example +++ b/.env.example @@ -5,7 +5,6 @@ MQTT_KEEPALIVE=15 MQTT_USERNAME= MQTT_PASSWORD= MQTT_TOPIC='msh/#' -REDIS_HOST=localhost -REDIS_PORT=6379 +REDIS_URL='redis://localhost:6379' PROMETHEUS_ENDPOINT='http://grafana/api/v1/push' PROMETHEUS_TOKEN='changeme' \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 1cf2879..a8d5fe5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,8 +39,7 @@ services: # - MQTT_USERNAME=changeme # - MQTT_PASSWORD=changeme - MQTT_TOPIC=msh/EU_433/# - - REDIS_HOST=redis - - REDIS_PORT=6379 + - REDIS_URL=redis://redis:6379 networks: - mesh-bridge # Redis is being utilised for storing persistent state diff --git a/main.py b/main.py index f13a9e3..45844d1 100644 --- a/main.py +++ b/main.py @@ -50,8 +50,7 @@ "prometheus_token": os.environ.get("PROMETHEUS_TOKEN"), "prometheus_server_addr": os.environ.get("PROMETHEUS_SERVER_ADDR", "0.0.0.0"), "prometheus_server_port": os.environ.get("PROMETHEUS_SERVER_PORT", 9464), - "redis_host": os.environ.get("REDIS_HOST", "localhost"), - "redis_port": os.environ.get("REDIS_PORT", 6379), + "redis_url": os.environ.get("REDIS_URL", "redis://localhost:6379"), "log_level": os.environ.get("LOG_LEVEL", "INFO"), "flood_expire_time": os.environ.get("FLOOD_EXPIRE_TIME", 10 * 60), } @@ -69,9 +68,7 @@ logger.addHandler(handler) -redis = redis.Redis( - host=config["redis_host"], port=config["redis_port"], db=0, protocol=3 -) +redis = redis.from_url(config["redis_url"], db=0, protocol=3) headers = {} if config["prometheus_token"]: