initial rewrite, use micro v4 and not cms-xxx stuff

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2023-08-11 21:27:38 +03:00
parent b0f76d9bac
commit 2ef12956ac
22 changed files with 666 additions and 1036 deletions

View File

@@ -2,23 +2,21 @@ package service
import (
"context"
"net/http"
cmsservice "go.unistack.org/cms-service"
cmsstorage "go.unistack.org/cms-service/storage"
httpsrv "go.unistack.org/micro-server-http/v4"
"go.unistack.org/micro/v4"
"go.unistack.org/micro/v4/config"
"go.unistack.org/micro/v4/logger"
"go.unistack.org/micro/v4/options"
"go.unistack.org/micro/v4/register"
microuter "go.unistack.org/micro/v4/router"
intcfg "go.unistack.org/unistack-org/pkgdash/config"
"go.unistack.org/unistack-org/pkgdash/handler"
"go.unistack.org/unistack-org/pkgdash/handler/encoders"
"net/http"
//pbmicro "go.unistack.org/unistack-org/pkgdash/proto/micro"
"go.unistack.org/unistack-org/pkgdash/storage"
cmsservice "go.unistack.org/cms-service"
grpcsrv "go.unistack.org/micro-server-grpc/v3"
"go.unistack.org/micro/v3"
"go.unistack.org/micro/v3/config"
"go.unistack.org/micro/v3/logger"
"go.unistack.org/micro/v3/register"
microuter "go.unistack.org/micro/v3/router"
"go.unistack.org/micro/v3/server"
)
func NewService(ctx context.Context) (micro.Service, error) {
@@ -43,8 +41,8 @@ func NewService(ctx context.Context) (micro.Service, error) {
router = microuter.NewRouter()
}
mgsrv := grpcsrv.NewServer(
server.Register(reg),
mgsrv := httpsrv.NewServer(
options.Register(reg),
)
svc := micro.NewService(
@@ -81,9 +79,9 @@ func NewService(ctx context.Context) (micro.Service, error) {
}
if err := svc.Server("http").Init(
server.Address(cfg.App.Address),
server.Name(cfg.Service.Name),
server.Version(cfg.Service.Version),
options.Address(cfg.App.Address),
options.Name(cfg.Service.Name),
options.Version(cfg.Service.Version),
); err != nil {
return err
}