-
Notifications
You must be signed in to change notification settings - Fork 5
/
browse.go
31 lines (26 loc) · 1.48 KB
/
browse.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
package cmd
import (
"github.com/spf13/cobra"
"github.com/terrariumcloud/terrarium/internal/module/services/registrar"
"github.com/terrariumcloud/terrarium/internal/module/services/version_manager"
"github.com/terrariumcloud/terrarium/internal/release/services/release"
"github.com/terrariumcloud/terrarium/internal/restapi/browse"
)
var browseCmd = &cobra.Command{
Use: "browse",
Short: "Starts the Terrarium service that provides the web UI and its backing API",
Long: "Runs the Terrarium REST server for the implementation of webui server and backing API",
Run: runBrowseServer,
}
func init() {
browseCmd.Flags().StringVarP(®istrar.RegistrarServiceEndpoint, "registrar", "", registrar.DefaultRegistrarServiceEndpoint, "GRPC Endpoint for Registrar Service")
browseCmd.Flags().StringVarP(&version_manager.VersionManagerEndpoint, "version-manager", "", version_manager.DefaultVersionManagerEndpoint, "GRPC Endpoint for Version Manager Service")
browseCmd.Flags().StringVarP(&release.ReleaseServiceEndpoint, "release", "", release.DefaultReleaseServiceEndpoint, "GRPC Endpoint for Release Service")
rootCmd.AddCommand(browseCmd)
}
func runBrowseServer(cmd *cobra.Command, args []string) {
restAPIServer := browse.New(registrar.NewRegistrarGrpcClient(registrar.RegistrarServiceEndpoint),
version_manager.NewVersionManagerGrpcClient(version_manager.VersionManagerEndpoint),
release.NewBrowseGrpcClient(release.ReleaseServiceEndpoint))
startRESTAPIService("browse", "", restAPIServer)
}