Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
refactor!: remove DefaultKuboRPC
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Aug 22, 2023
1 parent d992d02 commit a6f0a2f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 0 additions & 2 deletions blockstore_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import (

const (
EnvProxyGateway = "PROXY_GATEWAY_URL"

DefaultKuboRPC = "http://127.0.0.1:5001"
)

type proxyBlockStore struct {
Expand Down
3 changes: 1 addition & 2 deletions docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@

### `KUBO_RPC_URL`

Default: see `DefaultKuboRPC`

Single URL or a comma separated list of RPC endpoints that provide `/api/v0` from Kubo.
This is used to redirect legacy `/api/v0` commands that need to be handled on `ipfs.io`.
If this is not set, the redirects are not set up.

### `BLOCK_CACHE_SIZE`

Expand Down
11 changes: 7 additions & 4 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,13 @@ func makeGatewayHandler(bs bstore.Blockstore, kuboRPC, gatewayURLs []string, por
mux := http.NewServeMux()
mux.Handle("/ipfs/", ipfsHandler)
mux.Handle("/ipns/", ipnsHandler)
// TODO: below is legacy which we want to remove, measuring this separately
// allows us to decide when is the time to do it.
legacyKuboRpcHandler := withHTTPMetrics(newKuboRPCHandler(kuboRPC), "legacyKuboRpc")
mux.Handle("/api/v0/", legacyKuboRpcHandler)

if len(kuboRPC) != 0 {
// TODO: below is legacy which we want to remove, measuring this separately
// allows us to decide when is the time to do it.
legacyKuboRpcHandler := withHTTPMetrics(newKuboRPCHandler(kuboRPC), "legacyKuboRpc")
mux.Handle("/api/v0/", legacyKuboRpcHandler)
}

// Construct the HTTP handler for the gateway.
handler := withConnect(mux)
Expand Down
7 changes: 5 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ See documentation at: https://github.com/ipfs/bifrost-gateway/#readme`,
// Get env variables.
saturnOrchestrator := getEnv(EnvSaturnOrchestrator, "")
proxyGateway := getEnvs(EnvProxyGateway, "")
kuboRPC := getEnvs(EnvKuboRPC, DefaultKuboRPC)
kuboRPC := getEnvs(EnvKuboRPC, "")

blockCacheSize, err := getEnvInt(EnvBlockCacheSize, lib.DefaultCacheBlockStoreSize)
if err != nil {
Expand Down Expand Up @@ -134,7 +134,10 @@ See documentation at: https://github.com/ipfs/bifrost-gateway/#readme`,
log.Printf("%s: %d", EnvBlockCacheSize, blockCacheSize)
log.Printf("%s: %t", EnvGraphBackend, useGraphBackend)

log.Printf("Legacy RPC at /api/v0 (%s) provided by %s", EnvKuboRPC, strings.Join(kuboRPC, " "))
if len(kuboRPC) != 0 {
log.Printf("Legacy RPC at /api/v0 (%s) provided by %s", EnvKuboRPC, strings.Join(kuboRPC, " "))
}

log.Printf("Path gateway listening on http://127.0.0.1:%d", gatewayPort)
log.Printf(" Smoke test (JPG): http://127.0.0.1:%d/ipfs/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi", gatewayPort)
log.Printf("Subdomain gateway configured on dweb.link and http://localhost:%d", gatewayPort)
Expand Down

0 comments on commit a6f0a2f

Please sign in to comment.