Configure the Coach from the environment
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
An instance can now be pointed at a model entirely from its environment — so a
container is redeployed with the Coach already working, and nobody has to open
an admin screen:
COACH_PROVIDER=compatible
COACH_BASE_URL=https://ai.example.com # WITHOUT /v1 — the adapter adds it
COACH_MODEL=vendor/model-name
COACH_API_KEY=sk-... # or the provider's own variable
Naming a provider is the whole configuration, so it also turns the Coach on: an
instance started this way that then reported itself "off" would be a puzzle with
no clue in it.
Three decisions worth stating:
- The environment is the *base*, the way DEFAULTS is, and the saved file is
layered on top: an admin who picked a provider in the app meant it, and this
only fills what is absent.
- The key is deliberately NOT a field of the config. That object is cached,
written to data/coach.json by any admin action, and included in the backup the
docs tell people to make. envCredentialFor reads it from the process
environment instead, so it is written nowhere and never surfaced by any route
that reports configuration. A pasted credential still outranks it, and a filed
one that fails to decrypt stays a failure rather than quietly falling back to
a key nobody knows is being spent.
- What the environment supplies is stripped before the file is written. A saved
config used to be written back whole, which would have frozen this start-up's
values on disk — and since the file outranks the environment, a later change
to COACH_MODEL would have been silently ignored.
Verified through the server's own path (config → credentialFor → jobEnv →
adapter) against the OpenAI-compatible router this fork runs on: a chest+triceps
request came back as a six-exercise routine with the cardio row first and
correctly marked `mode: cardio`.
This commit is contained in:
1 parent
327aa5211b
commit
238eb635c5
3 files changed
+215
-6
No files matched your search
+33
-3
@@ -163,9 +163,39 @@ RP_NAME=KuentaGYM
|
||||
#
|
||||
# COACH_JOB_TIMEOUT_MS=1500000
|
||||
#
|
||||
# Credentials never live here. They are encrypted into ./data/coach.json, one
|
||||
# per provider, or for the Codex provider cached in ./coach-auth — a sibling of ./data, never inside it,
|
||||
# so a live sign-in does not ride along in the documented backup archive.
|
||||
# ── Configuring the Coach from the environment ─────────────────────────────
|
||||
# Optional, and the alternative to the admin screen: an instance can be given
|
||||
# its provider at start-up, so a container is redeployed with the Coach already
|
||||
# pointed at a model and nobody has to open Settings → AI Coach. Naming a
|
||||
# provider here is the whole configuration — it also turns the Coach on — and
|
||||
# anything chosen later in the app wins over it.
|
||||
#
|
||||
# COACH_PROVIDER=compatible
|
||||
# COACH_BASE_URL=https://ai.example.com
|
||||
# COACH_MODEL=vendor/model-name
|
||||
# COACH_API_KEY=sk-...
|
||||
#
|
||||
# COACH_BASE_URL is the endpoint WITHOUT the /v1 suffix: the adapter appends
|
||||
# /v1/chat/completions itself, which is why the built-in OpenAI default is
|
||||
# https://api.openai.com and not .../v1. Getting this wrong looks like a
|
||||
# mysterious "unexpected response shape" in the job log rather than a 404.
|
||||
#
|
||||
# COACH_API_KEY may be omitted in favour of the variable the provider itself
|
||||
# declares — OPENAI_COMPAT_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY,
|
||||
# ANTHROPIC_API_KEY — which is also the name the key is passed under when the
|
||||
# request is made.
|
||||
#
|
||||
# A provider chosen in the app (or a key pasted there) outranks these: the
|
||||
# environment configures an instance nobody has set up in the UI, and never
|
||||
# overrides a choice someone made in one. What the environment supplies is
|
||||
# deliberately NOT written back into ./data/coach.json, so changing a variable
|
||||
# and redeploying always takes effect.
|
||||
#
|
||||
# Credentials never live in the config file. The ones pasted in the app are
|
||||
# encrypted into ./data/coach.json, one per provider, or for the Codex provider
|
||||
# cached in ./coach-auth — a sibling of ./data, never inside it, so a live
|
||||
# sign-in does not ride along in the documented backup archive. A key set here
|
||||
# is read from the environment at request time and written nowhere.
|
||||
# See docs/AI_COACH.md.
|
||||
# ── Hevy map regeneration (developers only) ────────────────────────────────
|
||||
# Not used by the running app. End users paste their own key in Settings →
|
||||
|
||||
Reference in new issue
Block a user