Skip to content

Commit

Permalink
webhook-server: remove config and connection caching
Browse files Browse the repository at this point in the history
and reload dotenv to fix interaction with caldav-trigger;
  • Loading branch information
tvogel committed Nov 26, 2024
1 parent f2c00a6 commit c67b300
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions webhook-server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python3
# coding: utf-8

from functools import cache
import json
import logging
import os
Expand All @@ -16,10 +15,9 @@
logger = logging.getLogger('uvicorn.error')

dotenv_file = dotenv.find_dotenv(usecwd=True) or dotenv.find_dotenv()
dotenv.load_dotenv(dotenv_file)

@cache
def get_config():
dotenv.load_dotenv(dotenv_file, override=True)
logger.info(f"Configuration read from {dotenv_file}")
scenes = dict(json.loads(os.getenv("webhook_server_scenes")))
scene_info = "Scenes:\n"
Expand All @@ -45,7 +43,6 @@ def get_config():
logger.info("Configuration saved.")
return { k: v for k, v in scenes.items() if k not in skip }

@cache
def get_client():
client = tuya_qr_sharing.TuyaQrSharing(dotenv_file)
if (result := client.connect()) != tuya_qr_sharing.EXIT_OK:
Expand Down

0 comments on commit c67b300

Please sign in to comment.