MCPcopy Create free account
hub / github.com/AmberSahdev/Open-Interface / load_settings_from_file

Method load_settings_from_file

app/utils/settings.py:48–72  ·  view source on GitHub ↗

if os.path.exists(self.settings_file_path): with open(self.settings_file_path, 'r') as file: try: settings = json.load(file) except: return {} # Decode the API key if 'api_ke

(self)

Source from the content-addressed store, hash-verified

46 json.dump(settings, file, indent=4)
47
48 def load_settings_from_file(self) -> dict[str, str]:
49 """
50 if os.path.exists(self.settings_file_path):
51 with open(self.settings_file_path, 'r') as file:
52 try:
53 settings = json.load(file)
54 except:
55 return {}
56
57 # Decode the API key
58 if 'api_key' in settings:
59 decoded_api_key = base64.b64decode(settings['api_key']).decode()
60 settings['api_key'] = decoded_api_key
61
62 return settings
63 else:
64 return {}
65 """
66 settings: dict[str, str] = self._read_settings_file()
67 # Decode the API keys
68 if 'api_key' in settings:
69 decoded_api_key = base64.b64decode(settings['api_key']).decode()
70 settings['api_key'] = decoded_api_key
71
72 return settings

Callers 1

__init__Method · 0.95

Calls 1

_read_settings_fileMethod · 0.95

Tested by

no test coverage detected