Skip to content

Commit

Permalink
startコマンドにmode flagを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
studiokaiji committed Oct 19, 2023
1 parent e18108a commit f62723e
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions hostr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ import (
var cuteOstrich string

func main() {
var (
port string
)

app := &cli.App{
Commands: []*cli.Command{
{
Expand Down Expand Up @@ -143,15 +139,28 @@ func main() {
Usage: "🕺 Wake up web server",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "port",
Aliases: []string{"p"},
Value: "3000",
Usage: "Web server port",
Destination: &port,
Name: "port",
Aliases: []string{"p"},
Value: "3000",
Usage: "Web server port",
},
&cli.StringFlag{
Name: "mode",
Aliases: []string{"m"},
Value: "normal",
Usage: "🧪 Experimental: Enabled subdomain-based access in replaceable events.",
Action: func(ctx *cli.Context, v string) error {
if v != "normal" && v != "hybrid" && v != "secure" {
return fmt.Errorf("Invalid mode flag. Must be 'normal', 'hybrid', or 'secure'.")
}
return nil
},
},
},
Action: func(ctx *cli.Context) error {
server.Start(port)
port := ctx.String("port")
mode := ctx.String("mode")
server.Start(port, mode)
return nil
},
},
Expand Down

0 comments on commit f62723e

Please sign in to comment.