Skip to content

Commit

Permalink
Add note about creating write tokens when user is not authenticated (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex authored May 6, 2024
1 parent a01e1a8 commit d6ca2c4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion logfire/_internal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,13 @@ def _get_user_token(cls, logfire_api_url: str) -> str:
data = cast(DefaultFile, read_toml_file(DEFAULT_FILE))
if is_logged_in(data, logfire_api_url): # pragma: no branch
return data['tokens'][logfire_api_url]['token']
raise LogfireConfigError('You are not authenticated. Please run `logfire auth` to authenticate.')
raise LogfireConfigError(
"""You are not authenticated. Please run `logfire auth` to authenticate.
If you are running in production, you can set the `LOGFIRE_TOKEN` environment variable.
To create a write token, refer to https://docs.pydantic.dev/logfire/guides/advanced/creating_write_tokens/
"""
)

@classmethod
def get_current_user(cls, session: requests.Session, logfire_api_url: str) -> dict[str, Any] | None:
Expand Down

0 comments on commit d6ca2c4

Please sign in to comment.