Support a remote ComfyUI via a .env config file
- run.sh / run.ps1: load an optional .env for host-specific env vars - .env.example + docs: ComfyUI can run on another host (ROUTER_COMFYUI) - .gitignore: .env Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
2f95e6be96
commit
ab0cd4fe85
@@ -0,0 +1,13 @@
|
|||||||
|
# Copy to `.env` (gitignored) for host-specific overrides. run.sh / run.ps1 load it.
|
||||||
|
# Only set what you need — every value has a sane default in router.py.
|
||||||
|
|
||||||
|
# ComfyUI image generation — point at wherever ComfyUI runs (another box is fine):
|
||||||
|
ROUTER_COMFYUI=http://comfyui-host.example:8188
|
||||||
|
ROUTER_COMFY_CHECKPOINT=your_model.safetensors
|
||||||
|
|
||||||
|
# Bind / networking (defaults shown):
|
||||||
|
# ROUTER_HOST=0.0.0.0
|
||||||
|
# ROUTER_OLLAMA=http://127.0.0.1:11434
|
||||||
|
|
||||||
|
# Audio model for /v1/audio/* (must have 'audio' capability):
|
||||||
|
# ROUTER_AUDIO_MODEL=gemma4:e4b
|
||||||
@@ -2,6 +2,9 @@
|
|||||||
.apikey
|
.apikey
|
||||||
.uncensored_key
|
.uncensored_key
|
||||||
|
|
||||||
|
# local host-specific config
|
||||||
|
.env
|
||||||
|
|
||||||
# python / venv
|
# python / venv
|
||||||
.venv/
|
.venv/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ in OpenAI's image-response shape — so any OpenAI image client works.
|
|||||||
| `ROUTER_COMFY_CHECKPOINT` | *(unset)* | your checkpoint filename, e.g. `sd_xl_base_1.0.safetensors` |
|
| `ROUTER_COMFY_CHECKPOINT` | *(unset)* | your checkpoint filename, e.g. `sd_xl_base_1.0.safetensors` |
|
||||||
| `ROUTER_COMFY_WORKFLOW` | `comfyui-workflow.json` | the workflow template (see below) |
|
| `ROUTER_COMFY_WORKFLOW` | `comfyui-workflow.json` | the workflow template (see below) |
|
||||||
|
|
||||||
|
Set these in a **`.env`** file (gitignored; copy `.env.example`) — `run.sh` /
|
||||||
|
`run.ps1` load it on start. **ComfyUI can run on another machine** — just point at
|
||||||
|
it, e.g. `ROUTER_COMFYUI=http://valhalla:8188`.
|
||||||
|
|
||||||
At minimum, **set `ROUTER_COMFY_CHECKPOINT`** to a model that exists in your
|
At minimum, **set `ROUTER_COMFY_CHECKPOINT`** to a model that exists in your
|
||||||
ComfyUI (`ComfyUI/models/checkpoints/`), or hardcode it into the template's
|
ComfyUI (`ComfyUI/models/checkpoints/`), or hardcode it into the template's
|
||||||
`ckpt_name`. Then restart the router.
|
`ckpt_name`. Then restart the router.
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
Set-Location $PSScriptRoot
|
Set-Location $PSScriptRoot
|
||||||
|
|
||||||
|
# optional local config (host-specific env vars, kept out of git — see .env.example)
|
||||||
|
if (Test-Path ".env") {
|
||||||
|
Get-Content ".env" | Where-Object { $_ -match '^\s*[^#=]+=' } | ForEach-Object {
|
||||||
|
$k, $v = $_ -split '=', 2
|
||||||
|
[Environment]::SetEnvironmentVariable($k.Trim(), $v.Trim(), 'Process')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# load keys from files into env (kept out of git)
|
# load keys from files into env (kept out of git)
|
||||||
if (Test-Path ".apikey") { $env:ROUTER_API_KEY = (Get-Content ".apikey" -Raw).Trim() }
|
if (Test-Path ".apikey") { $env:ROUTER_API_KEY = (Get-Content ".apikey" -Raw).Trim() }
|
||||||
if (Test-Path ".uncensored_key") { $env:ROUTER_UNCENSORED_KEY = (Get-Content ".uncensored_key" -Raw).Trim() }
|
if (Test-Path ".uncensored_key") { $env:ROUTER_UNCENSORED_KEY = (Get-Content ".uncensored_key" -Raw).Trim() }
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ set -uo pipefail
|
|||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
export PATH="/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin:${PATH:-}"
|
export PATH="/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin:${PATH:-}"
|
||||||
|
|
||||||
|
# optional local config (host-specific env vars, kept out of git — see .env.example)
|
||||||
|
[ -f .env ] && { set -a; . ./.env; set +a; }
|
||||||
|
|
||||||
# clear any stale instances via recorded PIDs (never pattern-match — that can
|
# clear any stale instances via recorded PIDs (never pattern-match — that can
|
||||||
# match unrelated processes, including a shell that merely mentions "router.py")
|
# match unrelated processes, including a shell that merely mentions "router.py")
|
||||||
for pf in .litellm.pid .router.pid; do
|
for pf in .litellm.pid .router.pid; do
|
||||||
|
|||||||
Reference in New Issue
Block a user