mirror of
https://github.com/peridotbuild/peridot.git
synced 2024-10-08 08:54:12 +00:00
Add temporal client to CMDs
This commit is contained in:
parent
da59a43a24
commit
9971185bd8
@ -18,6 +18,7 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
base "go.resf.org/peridot/base/go"
|
||||
mothershipadmin_rpc "go.resf.org/peridot/tools/mothership/admin/rpc"
|
||||
"go.temporal.io/sdk/client"
|
||||
"os"
|
||||
)
|
||||
|
||||
@ -27,8 +28,14 @@ func run(ctx *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
temporalClient, err := base.GetTemporalClientFromFlags(ctx, client.Options{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
s, err := mothershipadmin_rpc.NewServer(
|
||||
base.GetDBFromFlags(ctx),
|
||||
temporalClient,
|
||||
oidcInterceptorDetails,
|
||||
base.FlagsToGRPCServerOptions(ctx)...,
|
||||
)
|
||||
@ -46,7 +53,7 @@ func main() {
|
||||
app := &cli.App{
|
||||
Name: "mship_admin_server",
|
||||
Action: run,
|
||||
Flags: base.WithDefaultCliFlags(),
|
||||
Flags: base.WithDefaultCliFlagsTemporalClient(),
|
||||
}
|
||||
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
|
@ -30,6 +30,7 @@ import (
|
||||
mship_admin_ui "go.resf.org/peridot/tools/mothership/admin/ui"
|
||||
mothership_rpc "go.resf.org/peridot/tools/mothership/rpc"
|
||||
mship_ui "go.resf.org/peridot/tools/mothership/ui"
|
||||
"go.temporal.io/sdk/client"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
@ -65,8 +66,14 @@ func setupAdminUi(ctx *cli.Context) (*base.FrontendInfo, error) {
|
||||
}
|
||||
|
||||
func setupApi(ctx *cli.Context) (*runtime.ServeMux, error) {
|
||||
temporalClient, err := base.GetTemporalClientFromFlags(ctx, client.Options{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s, err := mothership_rpc.NewServer(
|
||||
base.GetDBFromFlags(ctx),
|
||||
temporalClient,
|
||||
base.WithGRPCPort(apiGrpcPort),
|
||||
base.WithNoGRPCGateway(),
|
||||
base.WithNoMetrics(),
|
||||
@ -91,8 +98,14 @@ func setupAdminApi(ctx *cli.Context) (*runtime.ServeMux, error) {
|
||||
}
|
||||
oidcInterceptorDetails.Group = "authors"
|
||||
|
||||
temporalClient, err := base.GetTemporalClientFromFlags(ctx, client.Options{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s, err := mothershipadmin_rpc.NewServer(
|
||||
base.GetDBFromFlags(ctx),
|
||||
temporalClient,
|
||||
oidcInterceptorDetails,
|
||||
base.WithGRPCPort(adminApiGrpcPort),
|
||||
base.WithNoGRPCGateway(),
|
||||
@ -152,14 +165,15 @@ func run(ctx *cli.Context) error {
|
||||
|
||||
func main() {
|
||||
base.ChangeDefaultDatabaseURL("mothership")
|
||||
base.ChangeDefaultForEnvVar(base.EnvVarTemporalTaskQueue, "mship_worker_server")
|
||||
|
||||
app := &cli.App{
|
||||
Name: "mship_dev",
|
||||
Action: run,
|
||||
Flags: base.WithDefaultCliFlagsNoAuth(base.WithDefaultFrontendCliFlags()...),
|
||||
Flags: base.WithDefaultCliFlagsNoAuthTemporal(base.WithDefaultFrontendCliFlags()...),
|
||||
}
|
||||
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
base.LogFatalf("failed to start mship_ui: %v", err)
|
||||
base.LogFatalf("failed to start mship_dev: %v", err)
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,19 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
base "go.resf.org/peridot/base/go"
|
||||
mothership_rpc "go.resf.org/peridot/tools/mothership/rpc"
|
||||
"go.temporal.io/sdk/client"
|
||||
"os"
|
||||
)
|
||||
|
||||
func run(ctx *cli.Context) error {
|
||||
temporalClient, err := base.GetTemporalClientFromFlags(ctx, client.Options{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
s, err := mothership_rpc.NewServer(
|
||||
base.GetDBFromFlags(ctx),
|
||||
temporalClient,
|
||||
base.FlagsToGRPCServerOptions(ctx)...,
|
||||
)
|
||||
if err != nil {
|
||||
@ -36,11 +43,12 @@ func main() {
|
||||
base.ChangeDefaultDatabaseURL("mothership")
|
||||
base.ChangeDefaultForEnvVar(base.EnvVarGRPCPort, "6677")
|
||||
base.ChangeDefaultForEnvVar(base.EnvVarGatewayPort, "6678")
|
||||
base.ChangeDefaultForEnvVar(base.EnvVarTemporalTaskQueue, "mship_worker_server")
|
||||
|
||||
app := &cli.App{
|
||||
Name: "mship_server",
|
||||
Action: run,
|
||||
Flags: base.WithDefaultCliFlagsNoAuth(),
|
||||
Flags: base.WithDefaultCliFlagsNoAuthTemporal(),
|
||||
}
|
||||
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
|
@ -52,7 +52,7 @@ func run(ctx *cli.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
keyRing, err := openpgp.ReadArmoredKeyRing(bytes.NewReader([]byte(decoded)))
|
||||
keyRing, err := openpgp.ReadArmoredKeyRing(bytes.NewReader(decoded))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user