cmd/tailscale/cli: make dev-store-set debug command a bit more magic

Temporarily at least. Makes sharing scripts during development easier.

Updates tailscale/corp#7515

Change-Id: I0e7aa461accd2c60740c1b37f3492b6bb58f1be3
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2022-11-09 06:34:27 -08:00 committed by Brad Fitzpatrick
parent df5e40f731
commit c35dcd427f

View File

@ -562,6 +562,16 @@ func runDebugComponentLogs(ctx context.Context, args []string) error {
} }
func runDevStoreSet(ctx context.Context, args []string) error { func runDevStoreSet(ctx context.Context, args []string) error {
// TODO(bradfitz): remove this temporary (2022-11-09) hack once
// profile stuff and serving CLI commands are more fleshed out.
if len(args) >= 1 && strings.HasPrefix(args[0], "_serve/") {
st, err := localClient.StatusWithoutPeers(ctx)
if err != nil {
return err
}
args[0] = "_serve/node-" + string(st.Self.ID)
log.Printf("Using key %q instead.", args[0])
}
if len(args) != 2 { if len(args) != 2 {
return errors.New("usage: dev-store-set --danger <key> <value>") return errors.New("usage: dev-store-set --danger <key> <value>")
} }