Skip to content

Commit

Permalink
Merge pull request #35 from linkml/modify_handle_auth
Browse files Browse the repository at this point in the history
Modify handle auth to allow for authentication db
  • Loading branch information
cmungall authored Feb 21, 2025
2 parents d886fe7 + 3264a38 commit 05ecef1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ RUN = poetry run
CODE = src/linkml_data_browser


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

Expand Down
10 changes: 7 additions & 3 deletions src/linkml_store/api/stores/mongodb/mongodb_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
from pathlib import Path
from typing import Optional, Union
from urllib.parse import urlparse

from pymongo import MongoClient
from pymongo.database import Database as NativeDatabase
Expand Down Expand Up @@ -38,10 +39,13 @@ def __init__(self, handle: Optional[str] = None, **kwargs):
@property
def _db_name(self) -> str:
if self.handle:
db = self.handle.split("/")[-1]
parsed_url = urlparse(self.handle)
path_parts = parsed_url.path.lstrip("/").split("?")[0].split("/")
print(path_parts)
db_name = path_parts[0] if path_parts else "default"
else:
db = "default"
return db
db_name = "default"
return db_name

@property
def native_client(self) -> MongoClient:
Expand Down

0 comments on commit 05ecef1

Please sign in to comment.