mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-06-26 22:19:57 +00:00
Fix: unify opendal config key from schema
to scheme
(#8232)
### What problem does this PR solve? This PR resolves the inconsistency in the opendal configuration where both `schema` and `scheme` were used as keys. The code and configuration file now consistently use `scheme`, which helps prevent configuration errors and runtime issues. This change improves code clarity and maintainability. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) ### Additional context - Updated both `conf/service_conf.yaml` and `rag/utils/opendal_conn.py` to use `scheme` instead of `schema` - No breaking changes to other configuration fields
This commit is contained in:
parent
3d0b440e9f
commit
6aa0b0819d
@ -29,7 +29,6 @@ redis:
|
|||||||
db: 1
|
db: 1
|
||||||
password: 'infini_rag_flow'
|
password: 'infini_rag_flow'
|
||||||
host: 'localhost:6379'
|
host: 'localhost:6379'
|
||||||
|
|
||||||
# postgres:
|
# postgres:
|
||||||
# name: 'rag_flow'
|
# name: 'rag_flow'
|
||||||
# user: 'rag_flow'
|
# user: 'rag_flow'
|
||||||
@ -61,7 +60,7 @@ redis:
|
|||||||
# container_name: 'container_name'
|
# container_name: 'container_name'
|
||||||
# The OSS object storage uses the MySQL configuration above by default. If you need to switch to another object storage service, please uncomment and configure the following parameters.
|
# The OSS object storage uses the MySQL configuration above by default. If you need to switch to another object storage service, please uncomment and configure the following parameters.
|
||||||
# opendal:
|
# opendal:
|
||||||
# schema: 'mysql' # Storage type, such as s3, oss, azure, etc.
|
# scheme: 'mysql' # Storage type, such as s3, oss, azure, etc.
|
||||||
# config:
|
# config:
|
||||||
# oss_table: 'your_table_name'
|
# oss_table: 'your_table_name'
|
||||||
# user_default_llm:
|
# user_default_llm:
|
||||||
|
@ -27,10 +27,10 @@ def get_opendal_config_from_yaml(yaml_path=SERVICE_CONF_PATH):
|
|||||||
|
|
||||||
opendal_config = config.get('opendal', {})
|
opendal_config = config.get('opendal', {})
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
if opendal_config.get("schema") == 'mysql':
|
if opendal_config.get("scheme") == 'mysql':
|
||||||
mysql_config = config.get('mysql', {})
|
mysql_config = config.get('mysql', {})
|
||||||
kwargs = {
|
kwargs = {
|
||||||
"schema": "mysql",
|
"scheme": "mysql",
|
||||||
"host": mysql_config.get("host", "127.0.0.1"),
|
"host": mysql_config.get("host", "127.0.0.1"),
|
||||||
"port": str(mysql_config.get("port", 3306)),
|
"port": str(mysql_config.get("port", 3306)),
|
||||||
"user": mysql_config.get("user", "root"),
|
"user": mysql_config.get("user", "root"),
|
||||||
@ -40,9 +40,9 @@ def get_opendal_config_from_yaml(yaml_path=SERVICE_CONF_PATH):
|
|||||||
}
|
}
|
||||||
kwargs["connection_string"] = f"mysql://{kwargs['user']}:{kwargs['password']}@{kwargs['host']}:{kwargs['port']}/{kwargs['database']}"
|
kwargs["connection_string"] = f"mysql://{kwargs['user']}:{kwargs['password']}@{kwargs['host']}:{kwargs['port']}/{kwargs['database']}"
|
||||||
else:
|
else:
|
||||||
schema = opendal_config.get("schema")
|
scheme = opendal_config.get("scheme")
|
||||||
config_data = opendal_config.get("config", {})
|
config_data = opendal_config.get("config", {})
|
||||||
kwargs = {"schema": schema, **config_data}
|
kwargs = {"scheme": scheme, **config_data}
|
||||||
logging.info("Loaded OpenDAL configuration from yaml: %s", kwargs)
|
logging.info("Loaded OpenDAL configuration from yaml: %s", kwargs)
|
||||||
return kwargs
|
return kwargs
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -54,11 +54,11 @@ def get_opendal_config_from_yaml(yaml_path=SERVICE_CONF_PATH):
|
|||||||
class OpenDALStorage:
|
class OpenDALStorage:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._kwargs = get_opendal_config_from_yaml()
|
self._kwargs = get_opendal_config_from_yaml()
|
||||||
self._schema = self._kwargs.get('schema', 'mysql')
|
self._scheme = self._kwargs.get('scheme', 'mysql')
|
||||||
if self._schema == 'mysql':
|
if self._scheme == 'mysql':
|
||||||
self.init_db_config()
|
self.init_db_config()
|
||||||
self.init_opendal_mysql_table()
|
self.init_opendal_mysql_table()
|
||||||
self._operator = opendal.Operator(self._schema, **self._kwargs)
|
self._operator = opendal.Operator(self._scheme, **self._kwargs)
|
||||||
|
|
||||||
logging.info("OpenDALStorage initialized successfully")
|
logging.info("OpenDALStorage initialized successfully")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user