wip
This commit is contained in:
@@ -3,7 +3,8 @@ package service
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
mclient "github.com/micro/go-micro/v2/client"
|
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
||||||
|
|
||||||
olog "github.com/owncloud/ocis/ocis-pkg/log"
|
olog "github.com/owncloud/ocis/ocis-pkg/log"
|
||||||
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
|
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
|
||||||
ssvc "github.com/owncloud/ocis/settings/pkg/service/v0"
|
ssvc "github.com/owncloud/ocis/settings/pkg/service/v0"
|
||||||
@@ -28,7 +29,7 @@ const (
|
|||||||
func RegisterPermissions(l *olog.Logger) {
|
func RegisterPermissions(l *olog.Logger) {
|
||||||
// TODO this won't work with a registry other than mdns. Look into Micro's client initialization.
|
// TODO this won't work with a registry other than mdns. Look into Micro's client initialization.
|
||||||
// https://github.com/owncloud/ocis-proxy/issues/38
|
// https://github.com/owncloud/ocis-proxy/issues/38
|
||||||
service := settings.NewBundleService("com.owncloud.api.settings", mclient.DefaultClient)
|
service := settings.NewBundleService("com.owncloud.api.settings", grpc.DefaultClient)
|
||||||
|
|
||||||
permissionRequests := generateAccountManagementPermissionsRequests()
|
permissionRequests := generateAccountManagementPermissionsRequests()
|
||||||
for i := range permissionRequests {
|
for i := range permissionRequests {
|
||||||
|
|||||||
@@ -9,12 +9,14 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
||||||
|
|
||||||
"github.com/owncloud/ocis/accounts/pkg/storage"
|
"github.com/owncloud/ocis/accounts/pkg/storage"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/indexer"
|
"github.com/owncloud/ocis/ocis-pkg/indexer"
|
||||||
idxcfg "github.com/owncloud/ocis/ocis-pkg/indexer/config"
|
idxcfg "github.com/owncloud/ocis/ocis-pkg/indexer/config"
|
||||||
idxerrs "github.com/owncloud/ocis/ocis-pkg/indexer/errors"
|
idxerrs "github.com/owncloud/ocis/ocis-pkg/indexer/errors"
|
||||||
|
|
||||||
mclient "github.com/micro/go-micro/v2/client"
|
//mclient "github.com/micro/go-micro/v2/client"
|
||||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||||
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||||
@@ -36,7 +38,7 @@ func New(opts ...Option) (s *Service, err error) {
|
|||||||
if roleService == nil {
|
if roleService == nil {
|
||||||
// https://github.com/owncloud/ocis-proxy/issues/38
|
// https://github.com/owncloud/ocis-proxy/issues/38
|
||||||
// TODO this won't work with a registry other than mdns. Look into Micro's client initialization.
|
// TODO this won't work with a registry other than mdns. Look into Micro's client initialization.
|
||||||
roleService = settings.NewRoleService("com.owncloud.api.settings", mclient.DefaultClient)
|
roleService = settings.NewRoleService("com.owncloud.api.settings", grpc.DefaultClient)
|
||||||
}
|
}
|
||||||
roleManager := options.RoleManager
|
roleManager := options.RoleManager
|
||||||
if roleManager == nil {
|
if roleManager == nil {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package service
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
mclient "github.com/micro/go-micro/v2/client"
|
|
||||||
olog "github.com/owncloud/ocis/ocis-pkg/log"
|
olog "github.com/owncloud/ocis/ocis-pkg/log"
|
||||||
|
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
||||||
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
|
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
|
||||||
ssvc "github.com/owncloud/ocis/settings/pkg/service/v0"
|
ssvc "github.com/owncloud/ocis/settings/pkg/service/v0"
|
||||||
)
|
)
|
||||||
@@ -17,7 +17,7 @@ const (
|
|||||||
func RegisterSettingsBundles(l *olog.Logger) {
|
func RegisterSettingsBundles(l *olog.Logger) {
|
||||||
// TODO this won't work with a registry other than mdns. Look into Micro's client initialization.
|
// TODO this won't work with a registry other than mdns. Look into Micro's client initialization.
|
||||||
// https://github.com/owncloud/ocis-proxy/issues/38
|
// https://github.com/owncloud/ocis-proxy/issues/38
|
||||||
service := settings.NewBundleService("com.owncloud.api.settings", mclient.DefaultClient)
|
service := settings.NewBundleService("com.owncloud.api.settings", grpc.DefaultClient)
|
||||||
|
|
||||||
bundleRequests := []settings.SaveBundleRequest{
|
bundleRequests := []settings.SaveBundleRequest{
|
||||||
generateBundleProfileRequest(),
|
generateBundleProfileRequest(),
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
||||||
|
|
||||||
"github.com/owncloud/ocis/glauth/pkg/metrics"
|
"github.com/owncloud/ocis/glauth/pkg/metrics"
|
||||||
|
|
||||||
"github.com/owncloud/ocis/glauth/pkg/crypto"
|
"github.com/owncloud/ocis/glauth/pkg/crypto"
|
||||||
@@ -17,7 +19,6 @@ import (
|
|||||||
glauthcfg "github.com/glauth/glauth/pkg/config"
|
glauthcfg "github.com/glauth/glauth/pkg/config"
|
||||||
|
|
||||||
"github.com/micro/cli/v2"
|
"github.com/micro/cli/v2"
|
||||||
"github.com/micro/go-micro/v2/client"
|
|
||||||
"github.com/oklog/run"
|
"github.com/oklog/run"
|
||||||
openzipkin "github.com/openzipkin/zipkin-go"
|
openzipkin "github.com/openzipkin/zipkin-go"
|
||||||
zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
|
zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
|
||||||
@@ -309,6 +310,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
|
|
||||||
// getAccountsServices returns an ocis-accounts service
|
// getAccountsServices returns an ocis-accounts service
|
||||||
func getAccountsServices() (accounts.AccountsService, accounts.GroupsService) {
|
func getAccountsServices() (accounts.AccountsService, accounts.GroupsService) {
|
||||||
return accounts.NewAccountsService("com.owncloud.api.accounts", client.DefaultClient),
|
return accounts.NewAccountsService("com.owncloud.api.accounts", grpc.DefaultClient),
|
||||||
accounts.NewGroupsService("com.owncloud.api.accounts", client.DefaultClient)
|
accounts.NewGroupsService("com.owncloud.api.accounts", grpc.DefaultClient)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -775,6 +775,8 @@ github.com/micro/cli/v2 v2.1.2 h1:43J1lChg/rZCC1rvdqZNFSQDrGT7qfMrtp6/ztpIkEM=
|
|||||||
github.com/micro/cli/v2 v2.1.2/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg=
|
github.com/micro/cli/v2 v2.1.2/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg=
|
||||||
github.com/micro/go-micro/v2 v2.9.1 h1:+S9koIrNWARjpP6k2TZ7kt0uC9zUJtNXzIdZTZRms7Q=
|
github.com/micro/go-micro/v2 v2.9.1 h1:+S9koIrNWARjpP6k2TZ7kt0uC9zUJtNXzIdZTZRms7Q=
|
||||||
github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY=
|
github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY=
|
||||||
|
github.com/micro/go-plugins v1.5.1 h1:swcFD7ynCTUo98APqIEIbPu2XMd6yVGTnI8PqdnCwOQ=
|
||||||
|
github.com/micro/go-plugins/v2 v2.0.0 h1:QbzQBaOVNtAIhjTgtLoOHtlhcwNFbcJenEsT66IwpkQ=
|
||||||
github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.9.1 h1:IaZUsLp0Omb/ozDnRKEvVY56C0UocBdPxxg2S2Pk2j0=
|
github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.9.1 h1:IaZUsLp0Omb/ozDnRKEvVY56C0UocBdPxxg2S2Pk2j0=
|
||||||
github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.9.1/go.mod h1:26UmOLM/I487NqTg3n6zJiBrYmIb684M2Zp4WH98XzU=
|
github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.9.1/go.mod h1:26UmOLM/I487NqTg3n6zJiBrYmIb684M2Zp4WH98XzU=
|
||||||
github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4=
|
github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4=
|
||||||
|
|||||||
@@ -1,14 +1,26 @@
|
|||||||
package grpc
|
package grpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/micro/go-micro/v2"
|
"github.com/micro/go-micro/v2"
|
||||||
|
mclient "github.com/micro/go-micro/v2/client"
|
||||||
|
"github.com/micro/go-micro/v2/client/grpc"
|
||||||
"github.com/micro/go-plugins/wrapper/trace/opencensus/v2"
|
"github.com/micro/go-plugins/wrapper/trace/opencensus/v2"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/wrapper/prometheus"
|
"github.com/owncloud/ocis/ocis-pkg/wrapper/prometheus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var DefaultClient = newGrpcClient()
|
||||||
|
|
||||||
|
func newGrpcClient() mclient.Client {
|
||||||
|
c := grpc.NewClient(
|
||||||
|
mclient.RequestTimeout(10 * time.Second),
|
||||||
|
)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
// Service simply wraps the go-micro grpc service.
|
// Service simply wraps the go-micro grpc service.
|
||||||
type Service struct {
|
type Service struct {
|
||||||
micro.Service
|
micro.Service
|
||||||
@@ -17,6 +29,7 @@ type Service struct {
|
|||||||
// NewService initializes a new grpc service.
|
// NewService initializes a new grpc service.
|
||||||
func NewService(opts ...Option) Service {
|
func NewService(opts ...Option) Service {
|
||||||
sopts := newOptions(opts...)
|
sopts := newOptions(opts...)
|
||||||
|
fmt.Printf("\n\n%v\n\n", sopts.Name)
|
||||||
|
|
||||||
sopts.Logger.Info().
|
sopts.Logger.Info().
|
||||||
Str("transport", "grpc").
|
Str("transport", "grpc").
|
||||||
@@ -33,6 +46,7 @@ func NewService(opts ...Option) Service {
|
|||||||
".",
|
".",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
micro.Client(DefaultClient),
|
||||||
micro.Version(sopts.Version),
|
micro.Version(sopts.Version),
|
||||||
micro.Address(sopts.Address),
|
micro.Address(sopts.Address),
|
||||||
micro.WrapHandler(prometheus.NewHandlerWrapper()),
|
micro.WrapHandler(prometheus.NewHandlerWrapper()),
|
||||||
|
|||||||
@@ -351,6 +351,8 @@ github.com/glauth/glauth v1.1.3-0.20201005201919-4d42af8aacbf h1:3ejnL7OvxCJ6XiE
|
|||||||
github.com/glauth/glauth v1.1.3-0.20201005201919-4d42af8aacbf/go.mod h1:ygO1z1pcp79iBrjbA6vqrsUxIonStjBncosl2a9/Dx8=
|
github.com/glauth/glauth v1.1.3-0.20201005201919-4d42af8aacbf/go.mod h1:ygO1z1pcp79iBrjbA6vqrsUxIonStjBncosl2a9/Dx8=
|
||||||
github.com/glauth/glauth v1.1.3-0.20201030130813-4f029234b230 h1:2oT6sD4SUhZ94BXf0NmOaKCwbkzsweBTYRPnyTDP7xY=
|
github.com/glauth/glauth v1.1.3-0.20201030130813-4f029234b230 h1:2oT6sD4SUhZ94BXf0NmOaKCwbkzsweBTYRPnyTDP7xY=
|
||||||
github.com/glauth/glauth v1.1.3-0.20201030130813-4f029234b230/go.mod h1:ygO1z1pcp79iBrjbA6vqrsUxIonStjBncosl2a9/Dx8=
|
github.com/glauth/glauth v1.1.3-0.20201030130813-4f029234b230/go.mod h1:ygO1z1pcp79iBrjbA6vqrsUxIonStjBncosl2a9/Dx8=
|
||||||
|
github.com/glauth/glauth v1.1.3-0.20201110124627-fd3ac7e4bbdc h1:xbCdy5zNO0CBDIpXQ9l4dfwgnTmjk9B0YyRjJkRndCc=
|
||||||
|
github.com/glauth/glauth v1.1.3-0.20201110124627-fd3ac7e4bbdc/go.mod h1:ygO1z1pcp79iBrjbA6vqrsUxIonStjBncosl2a9/Dx8=
|
||||||
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
|
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
|
||||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||||
github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2 h1:Ujru1hufTHVb++eG6OuNDKMxZnGIvF6o/u8q/8h2+I4=
|
github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2 h1:Ujru1hufTHVb++eG6OuNDKMxZnGIvF6o/u8q/8h2+I4=
|
||||||
@@ -921,6 +923,7 @@ github.com/micro/go-micro/v2 v2.0.0/go.mod h1:v7QP5UhKRt37ixjJe8DouWmg0/eE6dltr5
|
|||||||
github.com/micro/go-micro/v2 v2.8.0/go.mod h1:hSdOM6jb6aGswjBpCeB9wJ0yVH+CugevRm/CX7NlSrQ=
|
github.com/micro/go-micro/v2 v2.8.0/go.mod h1:hSdOM6jb6aGswjBpCeB9wJ0yVH+CugevRm/CX7NlSrQ=
|
||||||
github.com/micro/go-micro/v2 v2.9.1 h1:+S9koIrNWARjpP6k2TZ7kt0uC9zUJtNXzIdZTZRms7Q=
|
github.com/micro/go-micro/v2 v2.9.1 h1:+S9koIrNWARjpP6k2TZ7kt0uC9zUJtNXzIdZTZRms7Q=
|
||||||
github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY=
|
github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY=
|
||||||
|
github.com/micro/go-plugins v1.5.1 h1:swcFD7ynCTUo98APqIEIbPu2XMd6yVGTnI8PqdnCwOQ=
|
||||||
github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.0.1/go.mod h1:QrkcwcDtIs2hIJpIEhozekyf6Rfz5C36kFI8+zzCpX0=
|
github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.0.1/go.mod h1:QrkcwcDtIs2hIJpIEhozekyf6Rfz5C36kFI8+zzCpX0=
|
||||||
github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.9.1 h1:IaZUsLp0Omb/ozDnRKEvVY56C0UocBdPxxg2S2Pk2j0=
|
github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.9.1 h1:IaZUsLp0Omb/ozDnRKEvVY56C0UocBdPxxg2S2Pk2j0=
|
||||||
github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.9.1/go.mod h1:26UmOLM/I487NqTg3n6zJiBrYmIb684M2Zp4WH98XzU=
|
github.com/micro/go-plugins/wrapper/trace/opencensus/v2 v2.9.1/go.mod h1:26UmOLM/I487NqTg3n6zJiBrYmIb684M2Zp4WH98XzU=
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"github.com/go-chi/chi/middleware"
|
"github.com/go-chi/chi/middleware"
|
||||||
"github.com/go-chi/render"
|
"github.com/go-chi/render"
|
||||||
"github.com/micro/go-micro/v2/client/grpc"
|
"github.com/micro/go-micro/v2/client/grpc"
|
||||||
|
ogrpc "github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
||||||
|
|
||||||
mclient "github.com/micro/go-micro/v2/client"
|
|
||||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/account"
|
"github.com/owncloud/ocis/ocis-pkg/account"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||||
@@ -41,7 +41,7 @@ func NewService(opts ...Option) Service {
|
|||||||
if roleService == nil {
|
if roleService == nil {
|
||||||
// https://github.com/owncloud/ocis-proxy/issues/38
|
// https://github.com/owncloud/ocis-proxy/issues/38
|
||||||
// TODO this won't work with a registry other than mdns. Look into Micro's client initialization.
|
// TODO this won't work with a registry other than mdns. Look into Micro's client initialization.
|
||||||
roleService = settings.NewRoleService("com.owncloud.api.settings", mclient.DefaultClient)
|
roleService = settings.NewRoleService("com.owncloud.api.settings", ogrpc.DefaultClient)
|
||||||
}
|
}
|
||||||
roleManager := options.RoleManager
|
roleManager := options.RoleManager
|
||||||
if roleManager == nil {
|
if roleManager == nil {
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ import (
|
|||||||
"github.com/coreos/go-oidc"
|
"github.com/coreos/go-oidc"
|
||||||
"github.com/justinas/alice"
|
"github.com/justinas/alice"
|
||||||
"github.com/micro/cli/v2"
|
"github.com/micro/cli/v2"
|
||||||
mclient "github.com/micro/go-micro/v2/client"
|
|
||||||
"github.com/micro/go-micro/v2/client/grpc"
|
"github.com/micro/go-micro/v2/client/grpc"
|
||||||
"github.com/oklog/run"
|
"github.com/oklog/run"
|
||||||
openzipkin "github.com/openzipkin/zipkin-go"
|
openzipkin "github.com/openzipkin/zipkin-go"
|
||||||
zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
|
zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
|
||||||
acc "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
acc "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||||
|
ogrpc "github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
||||||
"github.com/owncloud/ocis/proxy/pkg/config"
|
"github.com/owncloud/ocis/proxy/pkg/config"
|
||||||
"github.com/owncloud/ocis/proxy/pkg/cs3"
|
"github.com/owncloud/ocis/proxy/pkg/cs3"
|
||||||
"github.com/owncloud/ocis/proxy/pkg/flagset"
|
"github.com/owncloud/ocis/proxy/pkg/flagset"
|
||||||
@@ -254,8 +254,8 @@ func loadMiddlewares(ctx context.Context, l log.Logger, cfg *config.Config) alic
|
|||||||
|
|
||||||
// TODO this won't work with a registry other than mdns. Look into Micro's client initialization.
|
// TODO this won't work with a registry other than mdns. Look into Micro's client initialization.
|
||||||
// https://github.com/owncloud/ocis/proxy/issues/38
|
// https://github.com/owncloud/ocis/proxy/issues/38
|
||||||
accounts := acc.NewAccountsService("com.owncloud.api.accounts", mclient.DefaultClient)
|
accounts := acc.NewAccountsService("com.owncloud.api.accounts", ogrpc.DefaultClient)
|
||||||
roles := settings.NewRoleService("com.owncloud.api.settings", mclient.DefaultClient)
|
roles := settings.NewRoleService("com.owncloud.api.settings", ogrpc.DefaultClient)
|
||||||
|
|
||||||
uuidMW := middleware.AccountUUID(
|
uuidMW := middleware.AccountUUID(
|
||||||
middleware.Logger(l),
|
middleware.Logger(l),
|
||||||
|
|||||||
Reference in New Issue
Block a user