mirror of
https://github.com/netbirdio/netbird.git
synced 2025-08-16 10:08:12 +02:00
Split client app into cmd and daemon service (#239)
This commit is contained in:
committed by
GitHub
parent
3e46f38166
commit
ef47385e38
@ -1,14 +1,30 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/kardianos/service"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/wiretrustee/wiretrustee/client/internal"
|
||||
)
|
||||
|
||||
type program struct {
|
||||
cmd *cobra.Command
|
||||
args []string
|
||||
ctx context.Context
|
||||
cmd *cobra.Command
|
||||
args []string
|
||||
serv *grpc.Server
|
||||
}
|
||||
|
||||
func newProgram(cmd *cobra.Command, args []string) *program {
|
||||
ctx := internal.CtxInitState(cmd.Context())
|
||||
return &program{
|
||||
ctx: ctx,
|
||||
cmd: cmd,
|
||||
args: args,
|
||||
}
|
||||
}
|
||||
|
||||
func newSVCConfig() *service.Config {
|
||||
@ -28,9 +44,8 @@ func newSVC(prg *program, conf *service.Config) (service.Service, error) {
|
||||
return s, nil
|
||||
}
|
||||
|
||||
var (
|
||||
serviceCmd = &cobra.Command{
|
||||
Use: "service",
|
||||
Short: "manages wiretrustee service",
|
||||
}
|
||||
)
|
||||
var serviceCmd = &cobra.Command{
|
||||
Use: "service",
|
||||
Short: "manages wiretrustee service",
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user