Skip to content

Commit

Permalink
feat(menu): allow overriding admin console URL via TAILRAY_ADMIN_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAShelf committed Jul 11, 2024
1 parent 4186e69 commit 6b7188a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,35 @@

A modern and fast implementation of tailscale-systray in Rust.

> [!NOTE] Tailray is a work in progress. Most things don't work, or work in a
> degraded state. If you find bugs that are not aggressed in the issues tab,
> feel free to create a new issue or a pull request! You are advi
<!-- deno-fmt-ignore-start -->

## Usage

> [!NOTE]
> Tailray is a work in progress. Most things don't work, or work in a
> degraded state. If you find bugs that are not addressed in the issues tab,
> feel free to create a new issue or a pull request!
<!-- deno-fmt-ignore-end -->

Tailray requires Tailscaled to be up and running. On Linux systems, you can
check its status with `systemctl status tailscaled`.

After you confirm that Tailscale is running, and that you are authenticated run
`tailray` from a terminal or consider writing a systemd service for it.

### Overriding Admin Console URL

Tailray will assume `https://login.tailscale.com/admin/machines` to be the Admin
Console URL by default. You may override this URL by setting `TAILRAY_ADMIN_URL`
to an URL of your choice.

## Hacking

Simply run `nix develop` in the project root.
The recommended way of building Tailray is with the Nix build tool. You may run
`nix develop` in the repository to enter a devShell with the necessary
dependencies. Direnv users may also use `direnv allow` to let direnv handle
their shell environment.

## License

Expand Down
5 changes: 4 additions & 1 deletion src/tray/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ impl Tray for SysTray {
StandardItem {
label: "Admin Console…".into(),
activate: Box::new(|_| {
if let Err(e) = open::that("https://login.tailscale.com/admin/machines") {
let admin_url = std::env::var("TAILRAY_ADMIN_URL").unwrap_or_else(|_| {
"https://login.tailscale.com/admin/machines".to_string()
});
if let Err(e) = open::that(admin_url.as_str()) {
eprintln!("failed to open admin console: {}", e);
}
}),
Expand Down

0 comments on commit 6b7188a

Please sign in to comment.