Skip to content

feat: add multi-tailnet configuration support to tscli #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jaxxstorm
Copy link
Owner

@jaxxstorm jaxxstorm commented Jul 24, 2025

Signed-off-by: Lee Briggs [email protected]


Important

Adds multi-tailnet configuration support to tscli with commands to manage tailnets, maintaining backward compatibility with legacy configuration.

  • Behavior:
    • Introduces multi-tailnet configuration support in tscli.
    • Adds commands in cmd/tscli/config/tailnet/cli.go to manage tailnets: add, remove, list, switch, and update.
    • Updates main.go to skip API key validation for config commands.
    • Updates client.go to use active tailnet configuration.
  • Configuration:
    • Adds TailnetConfig and Config structs in pkg/config/config.go.
    • Implements functions in pkg/config/config.go to manage tailnets: AddTailnet, RemoveTailnet, SetActiveTailnet, ListTailnets, GetActiveTailnetConfig.
    • Maintains backward compatibility with legacy single API key configuration.
  • Misc:
    • Updates configureCLI in main.go to handle new configuration mode.
    • Updates New function in client.go to support multi-tailnet configuration.

This description was created by Ellipsis for aeb5486. You can customize this summary. It will automatically update as commits are pushed.

@ellipsis-dev ellipsis-dev bot changed the title ... feat: add multi-tailnet configuration support to tscli Jul 24, 2025
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to aeb5486 in 1 minute and 29 seconds. Click for details.
  • Reviewed 644 lines of code in 10 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. cmd/tscli/config/tailnet/list/cli.go:35
  • Draft comment:
    For output type 'yaml', consider using a YAML marshaller instead of JSON marshalling to meet the expected output format.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% Without seeing the implementation of output.Print(), we can't be certain if using json.Marshal is problematic. The presence of yaml struct tags and the fact that output.Print takes both the outputType and data suggests it may handle the conversion internally. This could be an intentional design choice to reuse the JSON marshalling logic. I don't have visibility into output.Print() implementation. The current approach might be intentional and working correctly. Without seeing output.Print(), we can't be confident that this is actually a problem that needs fixing. The current implementation might be correct by design. Delete the comment as we don't have strong evidence that using json.Marshal is problematic, and the current implementation might be intentionally handling YAML conversion in output.Print().

Workflow ID: wflow_WXGQhx5877pIjyn8

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

tailnets := getTailnets()
for _, tailnet := range tailnets {
if tailnet.Name == activeName {
return &tailnet, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid taking the address of the loop variable in GetActiveTailnetConfig; use index-based iteration instead.

var currentTailnet *config.TailnetConfig
for _, tailnet := range tailnets {
if tailnet.Name == oldName {
currentTailnet = &tailnet
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid taking the address of the loop variable when searching for the existing tailnet; iterate by index to safely get a pointer.

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.

1 participant