Repository navigation
Load provider keys from a .env at the repo root - #28
Merged
Merged
Conversation
thee now reads the nearest .env at or above the current directory, stopping at the directory that holds .git. Shell variables win over the file, and a malformed line fails with its path and line number. Adds .env.example and un-ignores it. The M0 e2e test now runs the binary from its temp fixture so it never picks up a developer's real .env.
…/cli-execution-2fa5cf # Conflicts: # .gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On startup,
theeloads the nearest.envat or above the current directory, stopping at the directory that holds.git. This way the keys fortask eval,thee chatandthee runcan live in one file at the repo root. Variables already set in the shell win over the file.harness/internal/config/dotenv.go: the loader and parser. It acceptsKEY=VALUE,#comments, anexportprefix, quoted values and a leading UTF-8 BOM. A malformed line fails withpath:line: want KEY=VALUE.harness/cmd/thee/root.go: runs the loader inPersistentPreRunE..env.example: lists the OpenCode, DeepInfra and OpenAI keys. It's un-ignored, since.env.*was hiding it.TestM0RunE2Enow runs the binary from its temp fixture so it never loads a developer's real.env.**Upgrade:**note about malformed.envlines.Reviewer notes: the
.envis found from the process's working directory, not from-C/--directory.TestVerifyFailureIsLogged(director) failed onmainbefore this PR. After merging main, it should be re-checked against main's TUI/test fixes.Checks
go test ./harness/...,go vet ./harness/...,gofmt(config, e2e and cmd packages pass after merging main)docs/harness-architecture/updated (providers.md)