Skip to content

fix(config): read endpoints and credential names from the environment only - #166

Merged
goldbarth merged 1 commit into
mainfrom
fix/endpoints-from-environment-only
Sep 21, 2026
Merged

goldbarth merged 1 commit into
mainfrom
fix/endpoints-from-environment-only

Conversation

@goldbarth

Copy link
Copy Markdown
Owner

Closes #158

  • chartula.yaml may no longer set llm.baseUrl, llm.apiKeyEnvironmentVariable, github.apiBaseUrl or github.tokenEnvironmentVariable. The file is repository content, and these four decide where release data and credentials are sent. A file that sets one is refused at startup rather than ignored, and the message names the Chartula__ variable to use instead, so nobody believes a setting is in force that is not (OD1: no opt-in flag).
  • The process environment is no longer loaded whole. ChartulaConfiguration reads Chartula__* settings plus the credential variables Chartula uses: both providers' default key names, GITHUB_TOKEN, and whatever the two name settings point at. Those name settings can only come from the environment now, so no repository value can make an arbitrary variable readable (R03).
  • Every run prints the endpoints and credential variable names in force to stderr, never values (EndpointNotice). An environment is easy to inherit without reading it - a shell profile, a CI runner.
  • Error messages of the OpenAI-compatible provider name Chartula__Llm__BaseUrl instead of llm.baseUrl.
  • docs/configuration.md gets an "Environment-only settings" section; the local and hosted OpenAI-compatible examples, docs/cli.md and chartula.example.yaml move the four settings to the environment. This breaks a chartula.yaml that sets them; the refusal says how to fix it.

Repro: a checkout whose chartula.yaml sets github.apiBaseUrl: http://127.0.0.1:8765/ and github.tokenEnvironmentVariable: SOME_OTHER_SECRET, a local listener on that port, then SOME_OTHER_SECRET=topsecret chartula preview --tag v0.1.0 --repo owner/name. Before: the listener received Authorization: Bearer topsecret. After: the run exits 1 before any request, naming Chartula__GitHub__ApiBaseUrl and Chartula__GitHub__TokenEnvironmentVariable. The same two values set in the environment still work, and the run names them first.

Tests: ChartulaYamlConfigurationTests (each of the four keys refused naming its variable, all named at once); ChartulaConfigurationTests (an unrelated variable is not readable, default and renamed credentials are, environment overrides the file); EndpointNoticeTests (defaults and overrides, no values); RepositoryConfigurationTests runs the built CLI against the repro chartula.yaml. LlmWiringTests and GitHubTokenNoticeTests now build configuration the way Program does and set endpoints and names in the environment. The process helper from PlantedGitTests moved to CliProcess.

… only

chartula.yaml is repository content, but it set the LLM and GitHub
endpoints and the names of the variables whose values are sent to them.
One merged YAML diff could send any environment variable to any host, and
the whole process environment was loaded into configuration.

A file that sets one of those four keys is now refused, naming the
Chartula__ variable to use instead. Only Chartula__ settings and the
credential variables they name are read from the environment, and every
run prints the endpoints and credential names in force.

Closes #158
@goldbarth goldbarth self-assigned this Sep 21, 2026
@goldbarth
goldbarth merged commit 56a1bb4 into main Sep 21, 2026
4 checks passed
@goldbarth
goldbarth deleted the fix/endpoints-from-environment-only branch September 21, 2026 09:28
goldbarth added a commit that referenced this pull request Oct 1, 2026
…rd decided, recorded and amended (#318)

Follows #264, which moved the ADRs to `docs/development/adr/`, and #317,
which ruled out the claim that the audiences "cannot disagree".

- **Why:** the ADRs had one `Date` line that mixed when a decision was
taken with what changed later ("2026-07-16 (#45), extended by #96"), no
record of when each file was written, and no list of their own;
CONTRIBUTING kept the only list. ADR 0003 did not mention #235, which
added a refusal to the decision it records, and ADR 0002's title named
the tools rather than the decision.
- **`docs/development/adr/README.md`** holds the index, when to write an
ADR, and a template with separate fields: **Decided** (when it took
effect in the code, which can precede the record), **Recorded** (when
the file was written), and **Amended** (every later change to the
decision or to a fact in it, each dated with its pull request). A moved
file, a fixed link or a reworded sentence is not an amendment, so the
list stays a record of meaning.
- **0001** gives the date and pull request of each part: facts first on
2026-07-16 (#45), and the structure of a rendering on 2026-09-16 (#129,
for #96), which the Decision now marks as its own paragraph with the
reason #96 found. Amended here: "so they cannot disagree on what
happened" becomes what a shared fact base actually gives, the same
changes, categories and breaking status, and says why texts can still
disagree.
- **0002** is retitled to its decision, "Dependencies that keep a
native-AOT build reachable", and the file renamed to match; the Decision
opens on the rule the bullets implement. #268's correction of the
platform count is listed as its amendment.
- **0003** records #235: a model endpoint on the API host of the other
provider is refused before any request, with the reason (a key sent
there must be rotated) and why the list of hosts stays short. Dated
2026-09-23, the day of #235, and marked as recorded here.
- **CONTRIBUTING** links the index instead of listing the ADRs, and the
README's "Contribute" table gains a row for it, so the list exists in
one place.

**Verified:**
- Every date and number was taken from GitHub: the merge dates of #42,
#43, #45, #129, #166, #216, #235 and #268, and the issues each closes
(#3, #4, #6, #96, #158, #184, #233).
- What #268 changed in 0002 was read from its diff: the platform count,
nothing else. #264, #270 and #316 only moved the files or changed a
link, so they are not amendments.
- The rule 0003 now states was checked against `ProviderHost.cs` and
#235's description.
- Every relative link and anchor in all Markdown files of the repository
resolves (script, with a negative test); the renamed 0002 had no inbound
link besides CONTRIBUTING's list.

Tests: none, documentation only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chartula.yaml can set endpoints and the names of the credentials sent to them

1 participant