Skip to content

Commit 06ae475

Browse files
committed
Fixed middlewares
1 parent 2d8f2f7 commit 06ae475

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

gitlab_api/middlewares.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import os
12
import threading
23
from typing import Optional
34

45
import requests
56
from fastmcp.server.middleware import MiddlewareContext, Middleware
67
from fastmcp.utilities.logging import get_logger
78
from gitlab_api.gitlab_api import Api
9+
from gitlab_api.utils import to_boolean
810

911
local = threading.local()
1012
logger = get_logger(name="TokenMiddleware")
@@ -56,10 +58,10 @@ async def on_response(self, context: MiddlewareContext, call_next):
5658

5759

5860
def get_client(
59-
instance: str,
60-
token: Optional[str],
61-
verify: bool,
6261
config: dict,
62+
instance: str = os.getenv("GITLAB_INSTANCE", "https://gitlab.com"),
63+
token: Optional[str] = os.getenv("GITLAB_ACCESS_TOKEN", None),
64+
verify: bool = to_boolean(string=os.getenv("GITLAB_VERIFY", "True")),
6365
) -> Api:
6466
"""
6567
Factory function to create the Api client, either with fixed credentials or delegated token.

0 commit comments

Comments
 (0)