mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-09-30 03:51:43 +02:00
Prepare for release (#37)
* Prepare for release Added LICENSE, set version and configured GoReleaser/Docker * Updated LICENSE
This commit is contained in:
@@ -5,18 +5,32 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/cirruslabs/orchard/internal/controller"
|
||||
"github.com/cirruslabs/orchard/internal/netconstants"
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var ErrRunFailed = errors.New("failed to run controller")
|
||||
|
||||
var address string
|
||||
|
||||
func newRunCommand() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
cmd := &cobra.Command{
|
||||
Use: "run",
|
||||
Short: "Run the controller",
|
||||
RunE: runController,
|
||||
}
|
||||
|
||||
port := os.Getenv("PORT")
|
||||
if port == "" {
|
||||
port = strconv.FormatInt(netconstants.DefaultControllerPort, 10)
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().StringVarP(&address, "listen", "l", fmt.Sprintf(":%s", port), "address to listen on")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func runController(cmd *cobra.Command, args []string) (err error) {
|
||||
@@ -53,6 +67,7 @@ func runController(cmd *cobra.Command, args []string) (err error) {
|
||||
}
|
||||
|
||||
controller, err := controller.New(
|
||||
controller.WithListenAddr(address),
|
||||
controller.WithDataDir(dataDir),
|
||||
controller.WithLogger(logger),
|
||||
controller.WithTLSConfig(&tls.Config{
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/cirruslabs/orchard/internal/command/portforward"
|
||||
"github.com/cirruslabs/orchard/internal/command/stop"
|
||||
"github.com/cirruslabs/orchard/internal/command/worker"
|
||||
"github.com/cirruslabs/orchard/internal/version"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -19,6 +20,7 @@ func NewRootCmd() *cobra.Command {
|
||||
Use: "orchard",
|
||||
SilenceUsage: true,
|
||||
SilenceErrors: true,
|
||||
Version: version.FullVersion,
|
||||
}
|
||||
|
||||
addGroupedCommands(command, "Working With Resources:",
|
||||
|
||||
Reference in New Issue
Block a user