mirror of
https://github.com/TencentCloud/Octop.git
synced 2026-10-16 05:39:20 +08:00
- Updated README files to include instructions for using a domestic mirror when the official GHCR is unreachable. - Introduced a new `docker-compose.cn.yml` file for pulling images from the Nanjing University GHCR source without local builds. - Enhanced documentation to clarify the usage of the new Docker configuration for users in China.
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
"""Compose must forward OCTOP_DATABASE_* into the container (issue #152)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from octop.config import _DATABASE_ENV_KEYS
|
|
|
|
|
|
def _compose_environment_entries(compose_text: str) -> str:
|
|
"""Return list-item lines under the octop service ``environment:`` key."""
|
|
marker = "\n environment:\n"
|
|
env_idx = compose_text.index(marker) + len(marker)
|
|
lines: list[str] = []
|
|
for line in compose_text[env_idx:].splitlines():
|
|
if line.startswith(" - "):
|
|
lines.append(line)
|
|
continue
|
|
break
|
|
return "\n".join(lines)
|
|
|
|
|
|
def test_docker_compose_forwards_database_env_keys() -> None:
|
|
"""docker/.env alone does not inject vars — they must be listed under environment."""
|
|
repo = Path(__file__).resolve().parents[2]
|
|
for name in ("docker-compose.yml", "docker-compose.cn.yml"):
|
|
text = (repo / "docker" / name).read_text(encoding="utf-8")
|
|
env_text = _compose_environment_entries(text)
|
|
missing = [k for k in _DATABASE_ENV_KEYS if f"{k}=" not in env_text]
|
|
assert not missing, f"{name} environment missing: {missing}"
|