Skip to content

Add LOGFIRE_BASE_URL env var support and refactor LOGFIRE_TOKEN#119

Merged
adriangb merged 3 commits intomainfrom
add-logfire-base-url-env-var
Mar 2, 2026
Merged

Add LOGFIRE_BASE_URL env var support and refactor LOGFIRE_TOKEN#119
adriangb merged 3 commits intomainfrom
add-logfire-base-url-env-var

Conversation

@adriangb
Copy link
Member

@adriangb adriangb commented Feb 26, 2026

Summary

  • Add LOGFIRE_BASE_URL env var support with priority order: programmatic with_base_url() > LOGFIRE_BASE_URL env var > credentials file > token region parsing
  • Refactor LOGFIRE_TOKEN env var to use OptionalConfigValue pattern, consistent with all other env vars
  • Add tests verifying env var works, programmatic config overrides env, and env overrides credentials file
  • Add base url derivations from write tokens for our staging envs (internal nice to have)

Test plan

  • All 42 existing unit tests pass
  • New test: test_base_url_from_env_var — env var sets base URL
  • New test: test_base_url_programmatic_overrides_env — programmatic config takes precedence
  • New test: test_token_from_env_var — token via env var works with refactored code
  • New test: test_base_url_env_overrides_credentials_file — env var overrides credentials file

🤖 Generated with Claude Code

…o use `ConfigValue`

Add `LOGFIRE_BASE_URL` env var with priority: programmatic > env var > credentials file > token region.
Refactor `LOGFIRE_TOKEN` to use `OptionalConfigValue` pattern consistent with other env vars.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov-commenter
Copy link

codecov-commenter commented Feb 26, 2026

Codecov Report

❌ Patch coverage is 98.16514% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/logfire.rs 97.53% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@adriangb adriangb requested a review from cetra3 February 28, 2026 15:02
@adriangb adriangb marked this pull request as ready for review February 28, 2026 15:02
cetra3
cetra3 previously requested changes Mar 2, 2026
Copy link
Contributor

@cetra3 cetra3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should align with the base url derivation from tokens that happens in the python version

Align with the Python SDK's base URL derivation from tokens by adding
support for stagingus and stagingeu regions, mapping to .pydantic.info
domains.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@adriangb
Copy link
Member Author

adriangb commented Mar 2, 2026

Done!

@adriangb adriangb merged commit 188795d into main Mar 2, 2026
7 checks passed
@adriangb adriangb deleted the add-logfire-base-url-env-var branch March 2, 2026 15:34
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.

3 participants