refactor(gateway): replace flat-file import shims with installed package
Install bot_bottle via pip in Dockerfile.gateway instead of COPYing individual .py files flat under /app/. This eliminates the try/except import shims in egress_addon_core, dlp_detectors, egress_addon, supervise, supervise_server, and git_http_backend that existed only to support the flat-bundle layout. Adds bot_bottle/constants.py as a single source of truth for IDENTITY_HEADER and GIT_GATE_TIMEOUT_SECS, removing the duplicated literal definitions in egress_addon.py, supervise_server.py, git_http_backend.py, and git_gate_render.py. Test files updated to match: test_supervise_server.py drops the sys.path.insert hack in favour of direct package imports; the egress_addon test shims no longer pre-populate sys.modules with a bare egress_addon_core alias.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
"""Shared wire-protocol constants for gateway-bundled modules.
|
||||
|
||||
Single source of truth for values that appear across the egress addon,
|
||||
git-http backend, supervise server, and git-gate renderer. Importing
|
||||
from this module instead of duplicating the literals means a rename is
|
||||
a one-line change and is caught by the type checker at the import site."""
|
||||
|
||||
# App-layer identity token header. Delivered as proxy credentials
|
||||
# (HTTPS_PROXY=http://<bottle_id>:<token>@gw) by launch; the egress
|
||||
# addon reads and strips it, the supervise server and git-http backend
|
||||
# read it for attribution, and none of them forward it upstream.
|
||||
IDENTITY_HEADER = "x-bot-bottle-identity"
|
||||
|
||||
# Shared timeout (seconds) for all git-gate subprocess and CGI calls:
|
||||
# git daemon (--timeout/--init-timeout), the access-hook subprocess in
|
||||
# git_http_backend, and the git http-backend CGI subprocess.
|
||||
GIT_GATE_TIMEOUT_SECS = 15
|
||||
Reference in New Issue
Block a user