/
frontline.go
36 lines (32 loc) · 1.06 KB
/
frontline.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package commands
import (
"context"
"github.com/numaproj-labs/numaserve/pkg/frontline"
"github.com/spf13/cobra"
)
func NewFrontlineCommand() *cobra.Command {
var (
insecure bool
port int
sync bool
configpath string
backendURL string
)
command := &cobra.Command{
Use: "frontline",
Short: "Start a Front line server",
Run: func(cmd *cobra.Command, args []string) {
if !cmd.Flags().Changed("port") && insecure {
port = 8080
}
server := frontline.NewFrontLineService(port, backendURL)
server.Run(context.Background())
},
}
command.Flags().BoolVar(&insecure, "insecure", false, "Whether to disable TLS, defaults to false.")
command.Flags().IntVarP(&port, "port", "p", 8443, "Port to listen on, defaults to 8443 or 8080 if insecure is set")
command.Flags().BoolVar(&sync, "sync", false, "Start Frontline server with Synchronous.")
command.Flags().StringVar(&backendURL, "backendurl", "", "Backend Service URL")
command.Flags().StringVar(&configpath, "configpath", "/tmp/config/config.json", "Config file path.")
return command
}