diff --git a/claude_bottle/backend/docker/pipelock.py b/claude_bottle/backend/docker/pipelock.py index 0e0bdc1..7b322a8 100644 --- a/claude_bottle/backend/docker/pipelock.py +++ b/claude_bottle/backend/docker/pipelock.py @@ -4,16 +4,23 @@ YAML-config generation from PipelockProxy.""" from __future__ import annotations +import os import subprocess from ...log import die, info, warn -from ...pipelock import ( - PIPELOCK_IMAGE, - PIPELOCK_PORT, - PipelockProxy, - PipelockProxyPlan, +from ...pipelock import PipelockProxy, PipelockProxyPlan + + +# Pipelock image, pinned by digest. The digest is the multi-arch image +# index for ghcr.io/luckypipewrench/pipelock:2.3.0. +PIPELOCK_IMAGE = os.environ.get( + "CLAUDE_BOTTLE_PIPELOCK_IMAGE", + "ghcr.io/luckypipewrench/pipelock@sha256:3b1a39417b98406ddc5dc2d8fcb42865ddc0c68a43d355db55f0f8cb06bc6de9", ) +# Listening port for pipelock's forward proxy. +PIPELOCK_PORT = os.environ.get("CLAUDE_BOTTLE_PIPELOCK_PORT", "8888") + def pipelock_container_name(slug: str) -> str: return f"claude-bottle-pipelock-{slug}" diff --git a/claude_bottle/pipelock.py b/claude_bottle/pipelock.py index 9d799d8..371f6b6 100644 --- a/claude_bottle/pipelock.py +++ b/claude_bottle/pipelock.py @@ -12,7 +12,6 @@ Image pin: ghcr.io/luckypipewrench/pipelock@sha256: for tag 2.3.0. from __future__ import annotations -import os from abc import ABC, abstractmethod from dataclasses import dataclass from pathlib import Path @@ -20,16 +19,6 @@ from pathlib import Path from .manifest import Bottle, Manifest from .util import is_ipv4_literal -# Pipelock image, pinned by digest. The digest is the multi-arch image -# index for ghcr.io/luckypipewrench/pipelock:2.3.0. -PIPELOCK_IMAGE = os.environ.get( - "CLAUDE_BOTTLE_PIPELOCK_IMAGE", - "ghcr.io/luckypipewrench/pipelock@sha256:3b1a39417b98406ddc5dc2d8fcb42865ddc0c68a43d355db55f0f8cb06bc6de9", -) - -# Listening port for pipelock's forward proxy. -PIPELOCK_PORT = os.environ.get("CLAUDE_BOTTLE_PIPELOCK_PORT", "8888") - # Baked-in default allowlist for hosts Claude Code itself needs. DEFAULT_ALLOWLIST: tuple[str, ...] = ( "api.anthropic.com", diff --git a/tests/test_pipelock_image.py b/tests/test_pipelock_image.py index c8c1213..ffb23b1 100644 --- a/tests/test_pipelock_image.py +++ b/tests/test_pipelock_image.py @@ -5,7 +5,7 @@ docker.""" import subprocess import unittest -from claude_bottle.pipelock import PIPELOCK_IMAGE +from claude_bottle.backend.docker.pipelock import PIPELOCK_IMAGE from tests._docker import skip_unless_docker diff --git a/tests/test_pipelock_sidecar_smoke.py b/tests/test_pipelock_sidecar_smoke.py index 30fe27f..dc0251e 100644 --- a/tests/test_pipelock_sidecar_smoke.py +++ b/tests/test_pipelock_sidecar_smoke.py @@ -12,8 +12,10 @@ import unittest import urllib.request from pathlib import Path -from claude_bottle.backend.docker.pipelock import DockerPipelockProxy -from claude_bottle.pipelock import PIPELOCK_IMAGE +from claude_bottle.backend.docker.pipelock import ( + PIPELOCK_IMAGE, + DockerPipelockProxy, +) from tests._docker import skip_unless_docker from tests.fixtures import fixture_minimal