Skip to content

Commit e3e3a46

Browse files
committed
Document base URL flag for CLI
1 parent 024cfaf commit e3e3a46

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

docs/reference/cli.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ logfire auth
2121
```
2222

2323
You will be prompted to select a [data region](./data-regions.md) (EU or US). To specify this
24-
via the cli instead of interactively, use `logfire --region eu auth` or `logfire --region eu auth`
24+
via the cli instead of interactively, use `logfire --region eu auth` or `logfire --region us auth`
25+
26+
!!! note
27+
If you're using a [self-hosted Logfire instance](./self-hosted/overview.md), you can authenticate by specifying your instance's URL using the `--base-url` flag:
28+
`logfire --base-url="https://<your_logfire_hostname>" auth`
2529

2630
Then you will be given the option to open logfire in your browser:
2731
![Terminal screenshot with Logfire auth command](../images/cli/terminal-screenshot-auth-1.png)

docs/reference/self-hosted/overview.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ logfire.configure(
4040
)
4141
```
4242

43+
### CLI Authentication
44+
45+
You can also authenticate with your self-hosted instance using the CLI:
46+
47+
```bash
48+
logfire --base-url="https://<your_logfire_hostname>" auth
49+
```
50+
51+
This will authenticate you against your self-hosted domain and store the credentials locally.
52+
4353
## Service Architecture
4454

4555
The Self-hosted deployment has a number of interdependent services that work to run logfire. Each component can be scaled independently of others depending on the utilisation of the system.

logfire/_internal/cli/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,9 @@ def _main(args: list[str] | None = None) -> None:
307307
global_opts = parser.add_argument_group(title='global options')
308308
url_or_region_grp = global_opts.add_mutually_exclusive_group()
309309
url_or_region_grp.add_argument('--logfire-url', help=argparse.SUPPRESS)
310-
url_or_region_grp.add_argument('--base-url', help=argparse.SUPPRESS)
310+
url_or_region_grp.add_argument(
311+
'--base-url', help='the base URL for self-hosted Logfire instances (e.g., http://localhost:8080)'
312+
)
311313
url_or_region_grp.add_argument('--region', choices=REGIONS, help='the region to use')
312314
parser.set_defaults(func=lambda _: parser.print_help()) # type: ignore
313315
subparsers = parser.add_subparsers(title='commands', metavar='')

tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def logfire_credentials() -> LogfireCredentials:
4949

5050
def test_no_args(capsys: pytest.CaptureFixture[str]) -> None:
5151
main([])
52-
assert 'usage: logfire [-h] [--version] [--region {us,eu}] ...' in capsys.readouterr().out
52+
assert 'usage: logfire [-h] [--version] [--base-url BASE_URL | --region {us,eu}] ...' in capsys.readouterr().out
5353

5454

5555
def test_version(capsys: pytest.CaptureFixture[str]) -> None:

0 commit comments

Comments
 (0)