func (e *Runtime) Serve() error {
	if err := tool.Validate(e); err != nil {
		return tool.WrapErrf(err, "Method: %s", "engine.Serve")
	}
	grpcServer := servers.NewGrpcServer(e.cfg)
	e.cancelFunc = append(e.cancelFunc, grpcServer.Shutdown)
	return errors.WithStack(grpcServer.Serve(e.lis.GRPCListener()))
}
Serve starts the runtime gRPC server.
package engine
import (
	"context"
	"github.com/autom8ter/engine/config"
	"github.com/autom8ter/engine/driver"
	"github.com/autom8ter/engine/lis"
	"github.com/autom8ter/engine/servers"
	"github.com/autom8ter/objectify"
	"github.com/pkg/errors"
	"google.golang.org/grpc/grpclog"
	"net/http"
)
var tool = objectify.Default()
type Engine interface {
	Proxy(server *http.Server) error
	With(opts ...config.Option) *Runtime
	Config() *config.Config
	Shutdown(ctx context.Context)
	Serve() error
}
func New(network, addr string, debug bool) Engine {
	cfg := config.New(network, addr, debug)
	l, err := cfg.CreateListener()
	if err != nil {
		grpclog.Fatalln(err.Error())
	}
	return &Runtime{
		cfg: cfg,
		lis: l,
	}
}
func Default(network, addr string, debug bool) Engine {
	r := &Runtime{
		cfg: config.New(network, addr, debug),
	}
	r.With(config.WithDefaultPlugins(), config.WithDefaultMiddlewares())
	return r
}
type Runtime struct {
	lis        *lis.Listener
	cfg        *config.Config `validate:"required"`
	cancelFunc []func()
}
func (e *Runtime) With(opts ...config.Option) *Runtime {
	return &Runtime{
		cfg: e.cfg.With(opts...),
	}
}
func (e *Runtime) Config() *config.Config {
	return e.cfg
}