Skip to content

Commit 05ecef1

Browse files
authored
Merge pull request #35 from linkml/modify_handle_auth
Modify handle auth to allow for authentication db
2 parents d886fe7 + 3264a38 commit 05ecef1

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ RUN = poetry run
22
CODE = src/linkml_data_browser
33

44

5-
test: pytest doctest
5+
test:
6+
${RUN} pytest -m "not integration and not neo4j" --ignore=src/linkml_store/inference/implementations/rag_inference_engine.py tests
67
test-core: pytest-core doctest
78
test-full: pytest-full doctest
89

src/linkml_store/api/stores/mongodb/mongodb_database.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import logging
44
from pathlib import Path
55
from typing import Optional, Union
6+
from urllib.parse import urlparse
67

78
from pymongo import MongoClient
89
from pymongo.database import Database as NativeDatabase
@@ -38,10 +39,13 @@ def __init__(self, handle: Optional[str] = None, **kwargs):
3839
@property
3940
def _db_name(self) -> str:
4041
if self.handle:
41-
db = self.handle.split("/")[-1]
42+
parsed_url = urlparse(self.handle)
43+
path_parts = parsed_url.path.lstrip("/").split("?")[0].split("/")
44+
print(path_parts)
45+
db_name = path_parts[0] if path_parts else "default"
4246
else:
43-
db = "default"
44-
return db
47+
db_name = "default"
48+
return db_name
4549

4650
@property
4751
def native_client(self) -> MongoClient:

0 commit comments

Comments
 (0)