A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(rexctl): keep the proxy bind when --bind is left out (#3597)
Hampus189720e60cc7
diff --git a/fluxer_docs/src/content/docs/operator/rexctl.mdx b/fluxer_docs/src/content/docs/operator/rexctl.mdxindex 162bf25c6..49aee121e 100644--- a/fluxer_docs/src/content/docs/operator/rexctl.mdx+++ b/fluxer_docs/src/content/docs/operator/rexctl.mdx@@ -493,7 +493,7 @@ rexctl proxy on [flags]- `--bind string`- Address your proxy connects to. The default is `127.0.0.1:8080`.+ Address your proxy connects to, kept when left out (127.0.0.1:8080 the first time).## rexctl registrationdiff --git a/fluxer_rexctl/cmd/proxy.go b/fluxer_rexctl/cmd/proxy.goindex 30eef7d39..49c661d67 100644--- a/fluxer_rexctl/cmd/proxy.go+++ b/fluxer_rexctl/cmd/proxy.go@@ -3,6 +3,7 @@package cmdimport (+ "cmp""context""fmt"@@ -28,10 +29,14 @@ func newProxyCmd(app *App) *cobra.Command {Args: noArgs,RunE: func(c *cobra.Command, _ []string) error {mode := settings.EdgeProxy- return setProxy(c.Context(), app, map[string]*string{settings.EdgeMode: &mode, settings.EdgeBind: &bind})+ changes := map[string]*string{settings.EdgeMode: &mode}+ if c.Flags().Changed("bind") {+ changes[settings.EdgeBind] = &bind+ }+ return setProxy(c.Context(), app, changes)},}- on.Flags().StringVar(&bind, "bind", "127.0.0.1:8080", "address your proxy connects to")+ on.Flags().StringVar(&bind, "bind", "", "address your proxy connects to, kept when left out (127.0.0.1:8080 the first time)")off := &cobra.Command{Use: "off",Short: "Serve HTTPS directly with a certificate from Let's Encrypt",@@ -50,6 +55,10 @@ func setProxy(ctx context.Context, app *App, changes map[string]*string) error {return err}on := changes[settings.EdgeMode] != nil+ if _, ok := changes[settings.EdgeBind]; on && !ok {+ bind := cmp.Or(inst.State.Settings[settings.EdgeBind], "127.0.0.1:8080")+ changes[settings.EdgeBind] = &bind+ }if mode := inst.State.Settings[settings.EdgeMode]; !on && mode != "" && mode != settings.EdgeBundled {if err := allowLowPorts(ctx, app, inst); err != nil {return err