From 51a48a430b55105748d4bec00d61e992e65aa223 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Sun, 17 May 2026 09:42:48 -0700 Subject: [PATCH] feat(config): add GPU_SERVER_URL alias for CF_ORCH_URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Self-hoster-friendly env var name. Priority: GPU_SERVER_URL → CF_ORCH_URL (compat) → https://orch.circuitforge.tech when CF_LICENSE_KEY is present (Paid+ auto-default). Resolved value written back to os.environ["CF_ORCH_URL"] at startup so all service callers remain unchanged. Bump version to 0.10.0. --- .env.example | 16 +++++++++------- app/core/config.py | 23 ++++++++++++++++++++++- pyproject.toml | 2 +- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 009c23c..4b38878 100644 --- a/.env.example +++ b/.env.example @@ -21,10 +21,12 @@ DATA_DIR=./data # IP this machine advertises to the coordinator (must be reachable from coordinator host) # CF_ORCH_ADVERTISE_HOST=10.1.10.71 -# CF-core hosted coordinator (managed cloud GPU inference — Paid+ tier) -# Set CF_ORCH_URL to use a hosted cf-orch coordinator instead of self-hosting. -# CF_LICENSE_KEY is read automatically by CFOrchClient for bearer auth. -# CF_ORCH_URL=https://orch.circuitforge.tech +# GPU inference server (cf-orch coordinator for recipe scan, LLM generation, etc.) +# GPU_SERVER_URL: set to your local cf-orch coordinator (self-hosted rack). +# CF_ORCH_URL is the backward-compat alias — both are honoured. +# Paid+ default: when CF_LICENSE_KEY is present and neither URL is set, +# the app automatically points to https://orch.circuitforge.tech. +# GPU_SERVER_URL=http://10.1.10.71:7700 # CF_LICENSE_KEY=CFG-KIWI-xxxx-xxxx-xxxx # LLM backend — env-var auto-config (no llm.yaml needed for bare-metal users) @@ -57,9 +59,9 @@ CF_APP_NAME=kiwi # Unset = auto-detect: true if CLOUD_MODE or circuitforge_orch is installed (paid+ local). # Set false to force LocalScheduler even when cf-orch is present. # USE_ORCH_SCHEDULER=false -# CF_ORCH_URL: coordinator endpoint. Required for recipe scan (cf-docuvision) and -# LLM features when CF_ORCH_URL is the only backend. Local rack: http://10.1.10.71:7700 -# CF_ORCH_URL=http://10.1.10.71:7700 +# GPU_SERVER_URL: cf-orch coordinator endpoint. Required for recipe scan (cf-docuvision) +# and LLM features on a self-hosted rack. CF_ORCH_URL is the backward-compat alias. +# GPU_SERVER_URL=http://10.1.10.71:7700 # Cloud mode (set in compose.cloud.yml; also set here for reference) # CLOUD_DATA_ROOT=/devl/kiwi-cloud-data diff --git a/app/core/config.py b/app/core/config.py index 93ab6a5..b0c2458 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -65,9 +65,24 @@ class Settings: # Quality MIN_QUALITY_SCORE: float = float(os.environ.get("MIN_QUALITY_SCORE", "50.0")) - # CF-core resource coordinator (VRAM lease management) + # CF-core resource coordinator (VRAM lease management — lease broker, not inference) COORDINATOR_URL: str = os.environ.get("COORDINATOR_URL", "http://localhost:7700") + # GPU inference server URL + # Priority: GPU_SERVER_URL env var → CF_ORCH_URL env var (backward compat) + # → https://orch.circuitforge.tech when CF_LICENSE_KEY is present (Paid+) + # Resolved value is written back to os.environ["CF_ORCH_URL"] at startup so + # all service-layer callers that read CF_ORCH_URL directly see the right URL. + GPU_SERVER_URL: str | None = ( + os.environ.get("GPU_SERVER_URL") + or os.environ.get("CF_ORCH_URL") + or ( + "https://orch.circuitforge.tech" + if os.environ.get("CF_LICENSE_KEY") + else None + ) + ) + # Hosted cf-orch coordinator — bearer token for managed cloud GPU inference (Paid+) # CFOrchClient reads CF_LICENSE_KEY automatically; exposed here for startup validation. CF_LICENSE_KEY: str | None = os.environ.get("CF_LICENSE_KEY") @@ -108,3 +123,9 @@ class Settings: settings = Settings() + +# Normalise GPU_SERVER_URL into CF_ORCH_URL so every service-layer caller that +# reads os.environ.get("CF_ORCH_URL") sees the resolved value, including the +# Paid+ cloud default injected above. +if settings.GPU_SERVER_URL: + os.environ["CF_ORCH_URL"] = settings.GPU_SERVER_URL diff --git a/pyproject.toml b/pyproject.toml index cb7fb04..38e89f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "kiwi" -version = "0.6.0" +version = "0.10.0" description = "Pantry tracking + leftover recipe suggestions" readme = "README.md" requires-python = ">=3.11"