MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / _initialize_secrets_manager

Function _initialize_secrets_manager

docker_ksm_utility.py:238–262  ·  view source on GitHub ↗

Initialize SecretsManager with proper error handling. Args: ksm_config_path (str): Path to KSM config file (optional) ksm_token (str): KSM access token (optional) Returns: SecretsManager: Initialized SecretsManager or None if failed

(ksm_config_path, ksm_token)

Source from the content-addressed store, hash-verified

236# =============================================================================
237
238def _initialize_secrets_manager(ksm_config_path, ksm_token):
239 """
240 Initialize SecretsManager with proper error handling.
241
242 Args:
243 ksm_config_path (str): Path to KSM config file (optional)
244 ksm_token (str): KSM access token (optional)
245
246 Returns:
247 SecretsManager: Initialized SecretsManager or None if failed
248 """
249 from keeper_secrets_manager_core import SecretsManager
250 from keeper_secrets_manager_core.storage import FileKeyValueStorage
251
252 try:
253 if ksm_config_path:
254 if not os.path.exists(ksm_config_path):
255 print("ERROR: KSM config file not found")
256 return None
257 return SecretsManager(config=FileKeyValueStorage(ksm_config_path))
258 else:
259 return SecretsManager(token=ksm_token)
260 except Exception as e:
261 print(f"ERROR: Failed to initialize SecretsManager: {e}")
262 return None
263
264
265def _get_secret_by_uid_or_title(secrets_manager, record_identifier):

Callers 2

download_configFunction · 0.85
upload_configFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected