/
registrar.go
31 lines (24 loc) · 939 Bytes
/
registrar.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/terrariumcloud/terrarium/internal/module/services/registrar"
"github.com/terrariumcloud/terrarium/internal/storage"
"github.com/spf13/cobra"
)
var registrarServiceCmd = &cobra.Command{
Use: "registrar",
Short: "Starts the Terrarium GRPC Registrar service",
Long: "Runs the Terrarium GRPC Registrar server.",
Run: runRegistrarService,
}
func init() {
rootCmd.AddCommand(registrarServiceCmd)
registrarServiceCmd.Flags().StringVarP(®istrar.RegistrarTableName, "table", "t", registrar.DefaultRegistrarTableName, "Module Registrar table name")
}
func runRegistrarService(cmd *cobra.Command, args []string) {
registrarServiceServer := ®istrar.RegistrarService{
Db: storage.NewDynamoDbClient(awsSessionConfig),
Table: registrar.RegistrarTableName,
Schema: registrar.GetModulesSchema(registrar.RegistrarTableName),
}
startGRPCService("registrar", registrarServiceServer)
}