graphql-engine/cli/pkg/deploy/deploy.go
Varun Dey 248ea61600 cli: expose deploy command in public API [GT-307]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6994
GitOrigin-RevId: 915e60952bc7c8f21169e4d49bb7733988a8ee40
2022-11-24 11:43:05 +00:00

35 lines
795 B
Go

package deploy
import (
"github.com/hasura/graphql-engine/cli/v2"
"github.com/hasura/graphql-engine/cli/v2/commands"
"github.com/hasura/graphql-engine/cli/v2/internal/errors"
)
type projectDeployExecutor struct {
ec *cli.ExecutionContext
opts commands.DeployOptions
}
func newProjectDeployExecutor(ec *cli.ExecutionContext) *projectDeployExecutor {
d := &projectDeployExecutor{
ec: ec,
opts: commands.DeployOptions{EC: ec},
}
return d
}
type ProjectDeployExecutorOptions func(executor *projectDeployExecutor)
func (d *projectDeployExecutor) deploy(opts ...ProjectDeployExecutorOptions) error {
var op errors.Op = "deploy.projectDeployExecutor.deploy"
for _, opt := range opts {
opt(d)
}
err := d.opts.Run()
if err != nil {
return errors.E(op, err)
}
return nil
}