Skip to content

Commit

Permalink
chore(cli): add proxy flag
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
Satont committed Jun 19, 2024
1 parent 69f1441 commit 0289210
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cli/internal/cmds/dev/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/twirapp/twir/cli/internal/cmds/dev/golang"
"github.com/twirapp/twir/cli/internal/cmds/dev/nodejs"
"github.com/twirapp/twir/cli/internal/cmds/migrations"
"github.com/twirapp/twir/cli/internal/cmds/proxy"
"github.com/urfave/cli/v2"
)

Expand All @@ -40,6 +41,11 @@ func CreateDevCommand() *cli.Command {
Value: false,
Usage: "run backend in debug mode",
},
&cli.BoolFlag{
Name: "proxy",
Value: false,
Usage: "start with proxy",
},
},
Before: func(context *cli.Context) error {
wd, err := os.Getwd()
Expand Down Expand Up @@ -116,6 +122,15 @@ func CreateDevCommand() *cli.Command {
return err
}

if c.Bool("proxy") {
go func() {
if err := proxy.Cmd.Run(c); err != nil {
pterm.Error.Println(err)
return
}
}()
}

exitSignal := make(chan os.Signal, 1)
signal.Notify(exitSignal, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)

Expand Down

0 comments on commit 0289210

Please sign in to comment.