FastAPI app, upstream Confluence/model adapters, authoritative history, rootless container lifecycle, artifact storage and downloads, fake peers under backend/dev, tests under tests/backend. Root pytest.ini deselects the live marker by default; requirements gain the backend dependencies.
32 lines
943 B
Python
32 lines
943 B
Python
#!/usr/bin/env python3
|
|
"""Standalone entrypoint for fake container Docker image over stdin/stdout."""
|
|
|
|
import asyncio
|
|
import os
|
|
import sys
|
|
|
|
# Ensure backend package is importable if running locally
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
|
|
|
|
from backend.dev.fake_peer import ScriptedContainerPeer
|
|
|
|
|
|
async def main():
|
|
loop = asyncio.get_running_loop()
|
|
reader = asyncio.StreamReader()
|
|
protocol = asyncio.StreamReaderProtocol(reader)
|
|
await loop.connect_read_pipe(lambda: protocol, sys.stdin)
|
|
|
|
w_transport, w_protocol = await loop.connect_write_pipe(
|
|
asyncio.streams.FlowControlMixin, sys.stdout
|
|
)
|
|
writer = asyncio.StreamWriter(w_transport, w_protocol, reader, loop)
|
|
|
|
scenario = os.getenv("FAKE_PEER_SCENARIO", "standard")
|
|
peer = ScriptedContainerPeer(scenario=scenario)
|
|
await peer.run(reader, writer)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|