1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-07 21:47:02 +09:00

move server config to drpc config

This commit is contained in:
Sergey Cherepanov 2023-06-08 12:35:29 +02:00
parent dad76def2f
commit c7828d0671
No known key found for this signature in database
GPG key ID: 87F8EDE8FBDF637C
3 changed files with 16 additions and 16 deletions

View file

@ -5,16 +5,3 @@ import "errors"
var (
ErrUnableToConnect = errors.New("unable to connect")
)
type ConfigGetter interface {
GetNet() Config
}
type Config struct {
Stream StreamConfig `yaml:"stream"`
}
type StreamConfig struct {
TimeoutMilliseconds int `yaml:"timeoutMilliseconds"`
MaxMsgSizeMb int `yaml:"maxMsgSizeMb"`
}

13
net/rpc/drpcconfig.go Normal file
View file

@ -0,0 +1,13 @@
package rpc
type ConfigGetter interface {
GetDrpc() Config
}
type Config struct {
Stream StreamConfig `yaml:"stream"`
}
type StreamConfig struct {
MaxMsgSizeMb int `yaml:"maxMsgSizeMb"`
}

View file

@ -5,7 +5,7 @@ import (
"github.com/anyproto/any-sync/app"
"github.com/anyproto/any-sync/app/logger"
"github.com/anyproto/any-sync/metric"
anyNet "github.com/anyproto/any-sync/net"
"github.com/anyproto/any-sync/net/rpc"
"go.uber.org/zap"
"net"
"storj.io/drpc"
@ -32,7 +32,7 @@ type DRPCServer interface {
type drpcServer struct {
drpcServer *drpcserver.Server
*drpcmux.Mux
config anyNet.Config
config rpc.Config
metric metric.Metric
}
@ -43,7 +43,7 @@ func (s *drpcServer) Name() (name string) {
}
func (s *drpcServer) Init(a *app.App) (err error) {
s.config = a.MustComponent("config").(anyNet.ConfigGetter).GetNet()
s.config = a.MustComponent("config").(rpc.ConfigGetter).GetDrpc()
s.metric, _ = a.Component(metric.CName).(metric.Metric)
s.Mux = drpcmux.New()