Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
fix: clean old gateway hardcoding
Browse files Browse the repository at this point in the history
  • Loading branch information
juligasa committed Jan 9, 2024
1 parent c1cc30b commit 261943c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
3 changes: 1 addition & 2 deletions backend/daemon/api/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ func New(
sync *future.ReadOnly[*syncing.Service],
wallet *wallet.Service,
LogLevel string,
testnet bool,
) Server {
doSync := func() error {
s, ok := sync.Get()
Expand All @@ -59,7 +58,7 @@ func New(
return nil
}

documentsSrv := documents.NewServer(repo.Identity(), db, &lazyDiscoverer{sync: sync, net: node}, &lazyGwClient{net: node}, LogLevel, testnet)
documentsSrv := documents.NewServer(repo.Identity(), db, &lazyDiscoverer{sync: sync, net: node}, &lazyGwClient{net: node}, LogLevel)
return Server{
Accounts: accounts.NewServer(repo.Identity(), blobs),
Daemon: daemon.NewServer(repo, blobs, wallet, doSync),
Expand Down
4 changes: 1 addition & 3 deletions backend/daemon/api/documents/v1alpha/documents.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,16 @@ type Server struct {
disc Discoverer
blobs *hyper.Storage
gwClient GatewayClient
testnet bool
}

// NewServer creates a new RPC handler.
func NewServer(me *future.ReadOnly[core.Identity], db *sqlitex.Pool, disc Discoverer, gwClient GatewayClient, LogLevel string, testnet bool) *Server {
func NewServer(me *future.ReadOnly[core.Identity], db *sqlitex.Pool, disc Discoverer, gwClient GatewayClient, LogLevel string) *Server {
srv := &Server{
db: db,
me: me,
disc: disc,
blobs: hyper.NewStorage(db, logging.New("mintter/hyper", LogLevel)),
gwClient: gwClient,
testnet: testnet,
}

return srv
Expand Down
2 changes: 1 addition & 1 deletion backend/daemon/api/documents/v1alpha/documents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ func newTestDocsAPI(t *testing.T, name string) *Server {
fut := future.New[core.Identity]()
require.NoError(t, fut.Resolve(u.Identity))

srv := NewServer(fut.ReadOnly, db, nil, nil, "debug", true)
srv := NewServer(fut.ReadOnly, db, nil, nil, "debug")
bs := hyper.NewStorage(db, logging.New("mintter/hyper", "debug"))
_, err := daemon.Register(context.Background(), bs, u.Account, u.Device.PublicKey, time.Now())
require.NoError(t, err)
Expand Down
5 changes: 2 additions & 3 deletions backend/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func Load(ctx context.Context, cfg config.Config, r *storage.Dir, extraOpts ...i
}
}

a.GRPCServer, a.GRPCListener, a.RPC, err = initGRPC(ctx, cfg.GRPC.Port, &a.clean, a.g, a.Storage, a.DB, a.Blobs, a.Net, a.Syncing, a.Wallet, cfg.LogLevel, cfg.P2P.TestnetName != "", extraOpts...)
a.GRPCServer, a.GRPCListener, a.RPC, err = initGRPC(ctx, cfg.GRPC.Port, &a.clean, a.g, a.Storage, a.DB, a.Blobs, a.Net, a.Syncing, a.Wallet, cfg.LogLevel, extraOpts...)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -402,7 +402,6 @@ func initGRPC(
sync *future.ReadOnly[*syncing.Service],
wallet *wallet.Service,
LogLevel string,
testnet bool,
extras ...interface{},
) (srv *grpc.Server, lis net.Listener, rpc api.Server, err error) {
lis, err = net.Listen("tcp", ":"+strconv.Itoa(port))
Expand All @@ -418,7 +417,7 @@ func initGRPC(
}
srv = grpc.NewServer(opts...)

rpc = api.New(ctx, repo, pool, blobs, node, sync, wallet, LogLevel, testnet)
rpc = api.New(ctx, repo, pool, blobs, node, sync, wallet, LogLevel)
rpc.Register(srv)
reflection.Register(srv)

Expand Down

0 comments on commit 261943c

Please sign in to comment.