# ============================================================
# Yao CI Environment — sandbox-v2 (v1.0.0)
# Loaded via: cat .github/env/sandbox-v2.env >> $GITHUB_ENV
# ============================================================

# ========================================
# Yao Runtime (YAO_ prefix, read by Yao)
# ========================================
YAO_HOST=0.0.0.0
YAO_PORT=5099
YAO_GRPC_HOST=0.0.0.0
YAO_GRPC_PORT=9099
YAO_DB_DRIVER=sqlite3
YAO_SESSION=memory
YAO_ENV=development

# ========================================
# CI Test Parameters (YAO_CI_ prefix)
# ========================================

# -- Network --
YAO_CI_BRIDGE_IP=172.17.0.1

# -- Yao service ports (tests read these, not YAO_PORT/YAO_GRPC_PORT) --
YAO_CI_HTTP_PORT=5099
YAO_CI_GRPC_PORT=9099
YAO_CI_URL=http://127.0.0.1:5099
YAO_CI_GRPC=127.0.0.1:9099

# -- OAuth token generation (ci-token tool) --
YAO_CI_OAUTH_SUBJECT=ci-test-user
YAO_CI_OAUTH_USER_ID=ci-test-user
YAO_CI_OAUTH_TEAM_ID=ci-test-team
YAO_CI_OAUTH_SCOPE=tai:tunnel
YAO_CI_OAUTH_TTL=24h

# ========================================
# Tai Instances
#
# Connection modes:
#   tai-local     → DIRECT   (--direct, Yao dials Tai gRPC directly)
#   tai-docker    → TUNNEL   (default, Tai dials Yao gRPC, reverse tunnel)
#   tai-k8s       → TUNNEL   (same as above, with K8s runtime)
#   tai-hostexec  → TUNNEL   (same as above, no container runtime)
# ========================================

# -- tai-local (DIRECT mode, auto-detect Docker via /var/run/docker.sock) --
# Yao dials tai-local gRPC directly, so gRPC port must be reachable.
# Docker proxy on 12376 (not default 12375) to avoid conflict with tai-docker.
YAO_CI_TAI_LOCAL_HOST=127.0.0.1
YAO_CI_TAI_LOCAL_GRPC_PORT=19103
YAO_CI_TAI_LOCAL_HTTP_PORT=8102
YAO_CI_TAI_LOCAL_VNC_PORT=16083
YAO_CI_TAI_LOCAL_DOCKER_PORT=12376
YAO_CI_TAI_LOCAL_GRPC=127.0.0.1:19103
YAO_CI_TAI_LOCAL_DOCKER_API=tcp://127.0.0.1:12376

# -- tai-docker (TUNNEL mode, explicit Docker API proxy) --
# Tunnel: Tai connects to Yao gRPC. Sandbox connects to Yao, traffic forwarded via tunnel.
# gRPC port used only for Tai's own listener; Yao accesses via tunnel, not direct dial.
YAO_CI_TAI_DOCKER_HOST=127.0.0.1
YAO_CI_TAI_DOCKER_GRPC_PORT=19100
YAO_CI_TAI_DOCKER_HTTP_PORT=8099
YAO_CI_TAI_DOCKER_VNC_PORT=16080
YAO_CI_TAI_DOCKER_API_PORT=12375
YAO_CI_TAI_DOCKER_API=tcp://127.0.0.1:12375

# -- tai-k8s (TUNNEL mode, K8s API proxy via k3d) --
# K8s proxy on 16444 (not 16443) because k3d --api-port already binds 16443.
# TAI_K8S_UPSTREAM points to k3d at 127.0.0.1:16443; proxy exposes on 16444.
YAO_CI_TAI_K8S_HOST=127.0.0.1
YAO_CI_TAI_K8S_GRPC_PORT=19101
YAO_CI_TAI_K8S_HTTP_PORT=8100
YAO_CI_TAI_K8S_VNC_PORT=16081
YAO_CI_TAI_K8S_API_PORT=16444
YAO_CI_K3D_API_PORT=16443

# -- tai-hostexec (TUNNEL mode, no container runtime, HostExec only) --
YAO_CI_TAI_HOSTEXEC_HOST=127.0.0.1
YAO_CI_TAI_HOSTEXEC_GRPC_PORT=19102
YAO_CI_TAI_HOSTEXEC_HTTP_PORT=8101
YAO_CI_TAI_HOSTEXEC_VNC_PORT=16082

# ========================================
# Sandbox V2 addresses (used by test code)
# ========================================
YAO_CI_SANDBOX_LOCAL_ADDR=tai://127.0.0.1:19103
YAO_CI_SANDBOX_DOCKER_ADDR=tai://127.0.0.1:19100
YAO_CI_SANDBOX_K8S_ADDR=tai://127.0.0.1:19101
YAO_CI_SANDBOX_IMAGE=yaoapp/tai-sandbox-test:latest

# ========================================
# HostExec addresses
# ========================================
YAO_CI_HOSTEXEC_LOCAL_ADDR=127.0.0.1:19103
YAO_CI_HOSTEXEC_DOCKER_ADDR=127.0.0.1:19100
YAO_CI_HOSTEXEC_K8S_ADDR=127.0.0.1:19101
YAO_CI_HOSTEXEC_ONLY_ADDR=127.0.0.1:19102

# -- Tunnel --
YAO_CI_TUNNEL=true

# ========================================
# Database (MySQL / PostgreSQL / SQLite)
# ========================================
MYSQL_TEST_HOST=127.0.0.1
MYSQL_TEST_PORT=3308
MYSQL_TEST_USER=test
MYSQL_TEST_PASS=123456

PG_TEST_HOST=127.0.0.1
PG_TEST_PORT=5432
PG_TEST_USER=test
PG_TEST_PASS=123456

SQLITE_DB=./app/db/yao.db

# ========================================
# Legacy variable mapping (migrate later)
# ========================================
TAI_TEST_HOST=127.0.0.1
TAI_TEST_DOCKER=tcp://127.0.0.1:12375
TAI_TEST_GRPC_PORT=19100
TAI_TEST_HTTP_PORT=8099
TAI_TEST_VNC_PORT=16080
TAI_TEST_DOCKER_PORT=12375
TAI_TEST_K8S_HOST=127.0.0.1
TAI_TEST_K8S_PORT=16444
TAI_TEST_K8S_GRPC_PORT=19101
TAI_TEST_K8S_HTTP_PORT=8100
TAI_TEST_K8S_VNC_PORT=16081
TAI_TEST_HOST_IP=172.17.0.1
TAI_TEST_TUNNEL=true
TAI_TEST_YAO_URL=http://127.0.0.1:5099
TAI_TEST_YAO_GRPC=127.0.0.1:9099
SANDBOX_TEST_LOCAL_ADDR=tai://127.0.0.1:19103
SANDBOX_TEST_REMOTE_ADDR=tai://127.0.0.1:19100
SANDBOX_TEST_K8S_REMOTE_ADDR=tai://127.0.0.1:19101
SANDBOX_TEST_HOSTEXEC_ADDR=tai://127.0.0.1:19102
SANDBOX_TEST_IMAGE=yaoapp/tai-sandbox-test:latest
DOCKER_BRIDGE_IP=172.17.0.1
