Files
opencloud/pkg/micro/grpc/grpc.go
2020-02-04 11:55:25 +01:00

28 lines
650 B
Go

package grpc
import (
"context"
"github.com/owncloud/ocis-accounts/pkg/config"
"github.com/owncloud/ocis-accounts/pkg/proto/v0"
svc "github.com/owncloud/ocis-accounts/pkg/service/v0"
"github.com/owncloud/ocis-pkg/service/grpc"
)
// NewService creates a grpc service
func NewService(c context.Context, cfg *config.Config) grpc.Service {
service := grpc.NewService(
// TODO options come from configuration
grpc.Name("accounts"),
grpc.Namespace("com.owncloud"),
grpc.Address("localhost:9999"),
grpc.Context(c),
)
hdlr := svc.New(cfg)
proto.RegisterSettingsServiceHandler(service.Server(), hdlr)
service.Init()
return service
}