feat(sdk): add configure({ token }) and align the hosted default - #5
Merged
Merged
Conversation
The SDK could only read its collector token from STATLESS_TELEMETRY_TOKEN, so a published CLI could not bake the token in through code. configure() now accepts token; it wins over the env var, which is still read at call time as the fallback (an empty string clears the override). Also point DEFAULT_HOSTED_ENDPOINT at https://in.statless.dev/v1/telemetry/ping, the SaaS ingestion host, matching the collector contract the SaaS now serves. Bumps the package to 0.1.2. Signed-off-by: dimitrisx26 <dxynos@outlook.com>
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.
What
configure({ token })sets theX-Statless-Tokenvalue. It takes precedence overSTATLESS_TELEMETRY_TOKEN, which is still read at call time as the fallback; an empty string clears the override.DEFAULT_HOSTED_ENDPOINTnow points athttps://in.statless.dev/v1/telemetry/ping(the SaaS ingestion host) instead oftelemetry.statless.dev.0.1.1 → 0.1.2.Why
The SaaS package embed snippet needs to bake an entity key into a published CLI. The SDK only allowed the token via an env var, which an end user would have to set.
configure({ token })lets the CLI author pass it in code. The hosted default now matches the host the SaaS actually serves.How verified
npm run lint(tsc) clean;npm test15 passing (including two new token tests);npm run buildandnpm run sizeOK (994 B gzipped, budget 2048).No collector changes. Consumed by
statless/statless-app#17.