refactor(backend_server.py): move known_clients.yaml to config/
This commit is contained in:
@@ -77,7 +77,7 @@ class BackendServer:
|
|||||||
known_clients: dict[str, dict[str, str | float]] = {}
|
known_clients: dict[str, dict[str, str | float]] = {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open("cache/known_clients.yaml", "r") as f:
|
with open("config/known_clients.yaml", "r") as f:
|
||||||
data = yaml.safe_load(f)
|
data = yaml.safe_load(f)
|
||||||
|
|
||||||
if not isinstance(data, dict):
|
if not isinstance(data, dict):
|
||||||
@@ -114,7 +114,7 @@ class BackendServer:
|
|||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
"known_clients.yaml not found, creating empty known clients list"
|
"known_clients.yaml not found, creating empty known clients list"
|
||||||
)
|
)
|
||||||
with open("cache/known_clients.yaml", "w") as f:
|
with open("config/known_clients.yaml", "w") as f:
|
||||||
yaml.safe_dump({"known_clients": {}}, f)
|
yaml.safe_dump({"known_clients": {}}, f)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.error(f"Error loading known clients: {e}")
|
self.logger.error(f"Error loading known clients: {e}")
|
||||||
@@ -124,7 +124,7 @@ class BackendServer:
|
|||||||
|
|
||||||
def _save_known_clients(self) -> None:
|
def _save_known_clients(self) -> None:
|
||||||
"""Save the list of known clients to a YAML file."""
|
"""Save the list of known clients to a YAML file."""
|
||||||
with open("cache/known_clients.yaml", "w") as f:
|
with open("config/known_clients.yaml", "w") as f:
|
||||||
yaml.safe_dump({"known_clients": self.known_clients}, f)
|
yaml.safe_dump({"known_clients": self.known_clients}, f)
|
||||||
self.logger.debug("Saved known clients")
|
self.logger.debug("Saved known clients")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user