feat: allow credentials via environment variables for headless deployments - #37
Open
lekker-solutions wants to merge 1 commit into
Open
feat: allow credentials via environment variables for headless deployments#37lekker-solutions wants to merge 1 commit into
lekker-solutions wants to merge 1 commit into
Conversation
…ments Resolve all credentials from env vars before falling back to the keychain/encrypted-file store, so containers and CI can authenticate without an interactive `crono login`: - KERNEL_API_KEY - CRONO_CRONOMETER_USERNAME - CRONO_CRONOMETER_PASSWORD Env vars take precedence over stored credentials. Centralizes the previously kernel-client-specific KERNEL_API_KEY check into getCredential(), updates the export error message to point at env vars, and documents the headless flow in the README.
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
Enables running
cronoin headless environments (containers, VMs, CI) without an interactivecrono login. All credentials can now be injected as environment variables at provision time.Changes
src/credentials.ts—getCredential()now checks environment variables before falling back to the keychain / encrypted-file store:KERNEL_API_KEY→ Kernel.sh API keyCRONO_CRONOMETER_USERNAME→ Cronometer emailCRONO_CRONOMETER_PASSWORD→ Cronometer passwordsrc/kernel/client.ts— removed the client-specificKERNEL_API_KEYenv check; centralized ingetCredential()src/cronometer/export.ts— missing-credentials error now points to env vars for headless setupsREADME.md— documented env-based auth with adocker runexampletests/credentials.test.ts— tests for env resolution, precedence over stored credentials, and fallbackEnv vars take precedence over stored credentials, matching the behavior
kernel/client.tsalready had forKERNEL_API_KEY.Container usage
No config file or keychain required. Backend defaults to Kernel (remote browser, no display needed); the existing
CRONO_GWT_PERMUTATION/CRONO_GWT_HEADERoverrides continue to work.Testing
npm test— 224 passing (14 in credentials, 3 new)npm run buildclean