cmd/tailscale/cli: update serve debug set command after FUS profile change
The key changed, but also we have a localapi method to set it anyway, so use that. Updates tailscale/corp#7515 Change-Id: Ia08ea2509f0bdd9b59e4c5de53aacf9a7d7eda36 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>pull/6313/head
parent
7c285fe7ee
commit
13bee8e91c
|
@ -562,17 +562,6 @@ var devStoreSetArgs struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
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.
|
|
||||||
isServe := len(args) >= 1 && strings.HasPrefix(args[0], "_serve/")
|
|
||||||
if isServe {
|
|
||||||
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>")
|
||||||
}
|
}
|
||||||
|
@ -585,11 +574,6 @@ func runDevStoreSet(ctx context.Context, args []string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if isServe {
|
|
||||||
if err := json.Unmarshal(valb, new(ipn.ServeConfig)); err != nil {
|
|
||||||
return fmt.Errorf("invalid JSON: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val = string(valb)
|
val = string(valb)
|
||||||
}
|
}
|
||||||
return localClient.SetDevStoreKeyValue(ctx, key, val)
|
return localClient.SetDevStoreKeyValue(ctx, key, val)
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
@ -101,6 +102,19 @@ func (e *serveEnv) stdout() io.Writer {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *serveEnv) runServe(ctx context.Context, args []string) error {
|
func (e *serveEnv) runServe(ctx context.Context, args []string) error {
|
||||||
|
// Undocumented debug command (not using ffcli subcommands) to set raw
|
||||||
|
// configs from stdin for now (2022-11-13).
|
||||||
|
if len(args) == 1 && args[0] == "set-raw" {
|
||||||
|
valb, err := io.ReadAll(os.Stdin)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sc := new(ipn.ServeConfig)
|
||||||
|
if err := json.Unmarshal(valb, sc); err != nil {
|
||||||
|
return fmt.Errorf("invalid JSON: %w", err)
|
||||||
|
}
|
||||||
|
return localClient.SetServeConfig(ctx, sc)
|
||||||
|
}
|
||||||
panic("TODO")
|
panic("TODO")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue