in cvm-attestation/src/EndpointSelector.py [0:0]
def _load_endpoints(self, json_file):
"""
Load endpoint data from a JSON file.
Parameters:
json_file (str): Path to the JSON file.
Returns:
dict: Dictionary of endpoints.
"""
self.logger.info(f"Loading endpoints from {json_file}")
try:
with open(json_file, 'r') as file:
endpoints = json.load(file)
cleaned_endpoints = {key.replace(" ", "").lower(): value for key, value in endpoints.items()}
return cleaned_endpoints
except json.JSONDecodeError:
self.logger.error(f"Error: Failed to decode JSON from file '{json_file}'.")
return {}
except FileNotFoundError:
self.logger.error(f"Error: JSON file '{json_file}' not found.")
return {}