fix(git-http): handle relative import when run as top-level script
git_http_backend.py is run as a standalone script in the sidecar container; relative imports don't work in that context. Fall back to an absolute import so the module loads correctly either way. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,12 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from urllib.parse import urlsplit
|
from urllib.parse import urlsplit
|
||||||
|
|
||||||
from .git_gate import GIT_GATE_TIMEOUT_SECS
|
try:
|
||||||
|
from .git_gate import GIT_GATE_TIMEOUT_SECS
|
||||||
|
except ImportError:
|
||||||
|
# Running as a top-level script inside the sidecar container
|
||||||
|
# (python3 /app/git_http_backend.py) rather than as part of a package.
|
||||||
|
from git_gate import GIT_GATE_TIMEOUT_SECS # type: ignore[no-redef]
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_PORT = 9420
|
DEFAULT_PORT = 9420
|
||||||
|
|||||||
Reference in New Issue
Block a user