mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-23 06:46:40 +08:00
Ref: update loggings (#11987)
### What problem does this PR solve? Ref: update loggins ### Type of change - [x] Refactoring
This commit is contained in:
@ -41,10 +41,20 @@ def get_opendal_config():
|
||||
scheme = opendal_config.get("scheme")
|
||||
config_data = opendal_config.get("config", {})
|
||||
kwargs = {"scheme": scheme, **config_data}
|
||||
safe_log_keys=['scheme', 'host', 'port', 'database', 'table']
|
||||
|
||||
# Only include non-sensitive keys in logs. Do NOT
|
||||
# add 'password' or any key containing embedded credentials
|
||||
# (like 'connection_string').
|
||||
safe_log_keys = ['scheme', 'host', 'port', 'database', 'table']
|
||||
loggable_kwargs = {k: v for k, v in kwargs.items() if k in safe_log_keys}
|
||||
logging.info("Loaded OpenDAL configuration(non sensitive): %s", loggable_kwargs)
|
||||
return kwargs
|
||||
logging.info("Loaded OpenDAL configuration (non sensitive): %s", loggable_kwargs)
|
||||
|
||||
# For safety, explicitly remove sensitive keys from kwargs after use
|
||||
if "password" in kwargs:
|
||||
del kwargs["password"]
|
||||
if "connection_string" in kwargs:
|
||||
del kwargs["connection_string"]
|
||||
return kwargs
|
||||
except Exception as e:
|
||||
logging.error("Failed to load OpenDAL configuration from yaml: %s", str(e))
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user