start.go 649 字节
Newer Older
S
stormgbs 已提交
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
package app

import (
	"github.com/spf13/cobra"
	utilerrors "k8s.io/apimachinery/pkg/util/errors"

	"github.com/alibaba/inclavare-containers/shim/cmd/signature-server/app/options"
)

func NewSignatureServer(stopCh <-chan struct{}) *cobra.Command {
	opts := options.NewSignatureServerOptions()
	cmd := &cobra.Command{
		Short: "Launch signature server",
		Long:  "Launch signature server",
		RunE: func(cmd *cobra.Command, args []string) error {
			errs := opts.Validate()
			if err := utilerrors.NewAggregate(errs); err != nil {
				return err
			}
			return runServer(opts, stopCh)
		},
	}
	flags := cmd.Flags()
	opts.AddFlags(flags)
	return cmd
}