Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove REST API #1040

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ lint-full:
@golangci-lint run ./... --config=./.golangci.full.yaml --deadline=5m

test-with-race:
${GOBIN} test -race -timeout 300s ./waku/... ./cmd/waku/server/...
${GOBIN} test -race -timeout 300s ./waku/...

test:
${GOBIN} test -timeout 300s ./waku/... ./cmd/waku/server/... -coverprofile=${GO_TEST_OUTFILE}.tmp -coverpkg ./...
${GOBIN} test -timeout 300s ./waku/... -coverprofile=${GO_TEST_OUTFILE}.tmp -coverpkg ./...
cat ${GO_TEST_OUTFILE}.tmp | grep -v ".pb.go" > ${GO_TEST_OUTFILE}
${GOBIN} tool cover -html=${GO_TEST_OUTFILE} -o ${GO_HTML_COV}

Expand Down
41 changes: 0 additions & 41 deletions cmd/waku/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,47 +479,6 @@ var (
Destination: &options.Metrics.Port,
EnvVars: []string{"WAKUNODE2_METRICS_SERVER_PORT"},
})
RESTFlag = altsrc.NewBoolFlag(&cli.BoolFlag{
Name: "rest",
Usage: "Enable Waku REST HTTP server",
Destination: &options.RESTServer.Enable,
EnvVars: []string{"WAKUNODE2_REST"},
})
RESTAddress = altsrc.NewStringFlag(&cli.StringFlag{
Name: "rest-address",
Value: "127.0.0.1",
Usage: "Listening address of the REST HTTP server",
Destination: &options.RESTServer.Address,
EnvVars: []string{"WAKUNODE2_REST_ADDRESS"},
})
RESTPort = altsrc.NewIntFlag(&cli.IntFlag{
Name: "rest-port",
Value: 8645,
Usage: "Listening port of the REST HTTP server",
Destination: &options.RESTServer.Port,
EnvVars: []string{"WAKUNODE2_REST_PORT"},
})
RESTRelayCacheCapacity = altsrc.NewIntFlag(&cli.IntFlag{
Name: "rest-relay-cache-capacity",
Value: 1000,
Usage: "Capacity of the Relay REST API message cache",
Destination: &options.RESTServer.RelayCacheCapacity,
EnvVars: []string{"WAKUNODE2_REST_RELAY_CACHE_CAPACITY"},
})
RESTFilterCacheCapacity = altsrc.NewIntFlag(&cli.IntFlag{
Name: "rest-filter-cache-capacity",
Value: 30,
Usage: "Capacity of the Filter REST API message cache",
Destination: &options.RESTServer.FilterCacheCapacity,
EnvVars: []string{"WAKUNODE2_REST_FILTER_CACHE_CAPACITY"},
})
RESTAdmin = altsrc.NewBoolFlag(&cli.BoolFlag{
Name: "rest-admin",
Value: false,
Usage: "Enable access to REST HTTP Admin API",
Destination: &options.RESTServer.Admin,
EnvVars: []string{"WAKUNODE2_REST_ADMIN"},
})
PProf = altsrc.NewBoolFlag(&cli.BoolFlag{
Name: "pprof",
Usage: "provides runtime profiling data at /debug/pprof in both REST and RPC servers if they're enabled",
Expand Down
6 changes: 0 additions & 6 deletions cmd/waku/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ func main() {
MetricsServer,
MetricsServerAddress,
MetricsServerPort,
RESTFlag,
RESTAddress,
RESTPort,
RESTRelayCacheCapacity,
RESTFilterCacheCapacity,
RESTAdmin,
PProf,
}

Expand Down
21 changes: 0 additions & 21 deletions cmd/waku/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import (
"github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoreds" // nolint: staticcheck
ws "github.com/libp2p/go-libp2p/p2p/transport/websocket"
"github.com/multiformats/go-multiaddr"
"github.com/waku-org/go-waku/cmd/waku/server/rest"
"github.com/waku-org/go-waku/logging"
"github.com/waku-org/go-waku/waku/metrics"
"github.com/waku-org/go-waku/waku/persistence"
Expand Down Expand Up @@ -388,20 +387,6 @@ func Execute(options NodeOptions) error {
}
}

var restServer *rest.WakuRest
if options.RESTServer.Enable {
wg.Add(1)
restConfig := rest.RestConfig{Address: options.RESTServer.Address,
Port: uint(options.RESTServer.Port),
EnablePProf: options.PProf,
EnableAdmin: options.RESTServer.Admin,
RelayCacheCapacity: uint(options.RESTServer.RelayCacheCapacity),
FilterCacheCapacity: uint(options.RESTServer.FilterCacheCapacity)}

restServer = rest.NewWakuRest(wakuNode, restConfig, logger)
restServer.Start(ctx, &wg)
}

wg.Wait()
logger.Info("Node setup complete")

Expand All @@ -414,12 +399,6 @@ func Execute(options NodeOptions) error {
// shut the node down
wakuNode.Stop()

if options.RESTServer.Enable {
if err := restServer.Stop(ctx); err != nil {
return err
}
}

if options.Metrics.Enable {
if err = metricsServer.Stop(ctx); err != nil {
return err
Expand Down
11 changes: 0 additions & 11 deletions cmd/waku/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,6 @@ type MetricsOptions struct {
Port int
}

// RESTServerOptions are settings used to start a rest http server
type RESTServerOptions struct {
Enable bool
Port int
Address string
Admin bool
RelayCacheCapacity int
FilterCacheCapacity int
}

// WSOptions are settings used for enabling websockets and secure websockets
// support
type WSOptions struct {
Expand Down Expand Up @@ -174,5 +164,4 @@ type NodeOptions struct {
DNSDiscovery DNSDiscoveryOptions
Rendezvous RendezvousOptions
Metrics MetricsOptions
RESTServer RESTServerOptions
}
13 changes: 0 additions & 13 deletions cmd/waku/server/no_rln.go

This file was deleted.

135 changes: 0 additions & 135 deletions cmd/waku/server/rest/admin.go

This file was deleted.

92 changes: 0 additions & 92 deletions cmd/waku/server/rest/admin_api.yaml

This file was deleted.

Loading
Loading