mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-21 06:01:42 +00:00
cmd/tailscale: add set-raw to the new serve funnel commands
This PR adds the same set-raw from the old flow into the new one so that users can continue to use it when transitioning into the new flow. Updates #8489 Signed-off-by: Marwan Sulaiman <marwan@tailscale.com>
This commit is contained in:
parent
f232d4554a
commit
c53ee37912
@ -5,6 +5,7 @@ package cli
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -185,6 +186,20 @@ func (e *serveEnv) runServeCombined(subcmd serveMode) execFunc {
|
|||||||
e.subcmd = subcmd
|
e.subcmd = subcmd
|
||||||
|
|
||||||
return func(ctx context.Context, args []string) error {
|
return func(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 e.lc.SetServeConfig(ctx, sc)
|
||||||
|
}
|
||||||
|
|
||||||
if err := validateArgs(subcmd, args); err != nil {
|
if err := validateArgs(subcmd, args); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user