Skip to content

Commit 49643b5

Browse files
Zhe YuDavidyz
authored andcommitted
drop support for host and port.
1 parent 18821d4 commit 49643b5

2 files changed

Lines changed: 1 addition & 23 deletions

File tree

src/vectorcode/cli_utils.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,20 +104,6 @@ async def import_from(cls, config_dict: dict[str, Any]) -> "Config":
104104
"""
105105
default_config = Config()
106106
db_path = config_dict.get("db_path")
107-
db_url = config_dict.get("db_url")
108-
if db_url is None:
109-
host = config_dict.get("host")
110-
port = config_dict.get("port")
111-
if host is not None or port is not None:
112-
# TODO: deprecate `host` and `port` in 0.7.0
113-
host = host or "127.0.0.1"
114-
port = port or 8000
115-
db_url = f"http://{host}:{port}"
116-
logger.warning(
117-
f'"host" and "port" are deprecated and will be removed in 0.7.0. Use "db_url" (eg. {db_url}).'
118-
)
119-
else:
120-
db_url = "http://127.0.0.1:8000"
121107

122108
if db_path is None:
123109
db_path = os.path.expanduser("~/.local/share/vectorcode/chromadb/")
@@ -133,7 +119,7 @@ async def import_from(cls, config_dict: dict[str, Any]) -> "Config":
133119
"embedding_params": config_dict.get(
134120
"embedding_params", default_config.embedding_params
135121
),
136-
"db_url": db_url,
122+
"db_url": config_dict.get("db_url", default_config.db_url),
137123
"db_path": db_path,
138124
"db_log_path": os.path.expanduser(
139125
config_dict.get("db_log_path", default_config.db_log_path)

tests/test_cli_utils.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,6 @@ async def test_config_import_from():
5353
assert config.db_settings == {"db_setting1": "db_value1"}
5454

5555

56-
@pytest.mark.asyncio
57-
async def test_config_import_from_fallback_host_port():
58-
conf = {"host": "test_host"}
59-
assert (await Config.import_from(conf)).db_url == "http://test_host:8000"
60-
conf = {"port": 114514}
61-
assert (await Config.import_from(conf)).db_url == "http://127.0.0.1:114514"
62-
63-
6456
@pytest.mark.asyncio
6557
async def test_config_import_from_invalid_path():
6658
config_dict: Dict[str, Any] = {"db_path": "/path/does/not/exist"}

0 commit comments

Comments
 (0)