-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CIEDEV-2140: Release Service Scaffolding (#37)
- Loading branch information
1 parent
23215b4
commit 5c75715
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/terrariumcloud/terrarium/internal/release/services/release" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var releaseServiceCmd = &cobra.Command{ | ||
Use: "publish", | ||
Short: "Starts the Terrarium GRPC Release service", | ||
Long: "Runs the Terrarium GRPC Release server.", | ||
Run: runReleaseService, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(releaseServiceCmd) | ||
// TODO: database | ||
//releaseServiceCmd.Flags().StringVarP(&release.ReleaseTableName, "table", "t", release.DefaultReleaseTableName, "Releases table name") | ||
} | ||
|
||
func runReleaseService(cmd *cobra.Command, args []string) { | ||
releaseServiceServer := &release.ReleaseService{ | ||
// Db: storage.NewDynamoDbClient(awsAccessKey, awsSecretKey, awsRegion), | ||
// Table: release.ReleaseTableName, | ||
// Schema: release.GetModulesSchema(release.ReleaseTableName), | ||
} | ||
|
||
startGRPCService("release", releaseServiceServer) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package release | ||
|
||
import ( | ||
releaseSvc "github.com/terrariumcloud/terrarium/internal/release/services" | ||
"google.golang.org/grpc" | ||
) | ||
|
||
type ReleaseService struct { | ||
releaseSvc.UnimplementedPublisherServer | ||
// Db storage.DynamoDBTableCreator | ||
// Table string | ||
// Schema *dynamodb.CreateTableInput | ||
} | ||
|
||
// Registers ReleaseService with grpc server | ||
func (s *ReleaseService) RegisterWithServer(grpcServer grpc.ServiceRegistrar) error { | ||
// if err := storage.InitializeDynamoDb(s.Table, s.Schema, s.Db); err != nil { | ||
// return ReleaseTableInitializationError | ||
// } | ||
|
||
releaseSvc.RegisterPublisherServer(grpcServer, s) | ||
|
||
return nil | ||
} |