instead of guessing the address, just use a config value
This commit is contained in:
parent
5b6bbfe903
commit
3ba2b0e365
@ -16,7 +16,6 @@ import (
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
record "github.com/libp2p/go-libp2p-record"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
manet "github.com/multiformats/go-multiaddr-net"
|
||||
"go.uber.org/fx"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -338,10 +337,7 @@ func ConfigCommon(cfg *config.Common) Option {
|
||||
return lr.SetAPIEndpoint(e)
|
||||
}),
|
||||
Override(new(sectorstorage.URLs), func(e dtypes.APIEndpoint) (sectorstorage.URLs, error) {
|
||||
_, ip, err := manet.DialArgs(e)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("getting api endpoint dial args: %w", err)
|
||||
}
|
||||
ip := cfg.API.RemoteListenAddress
|
||||
|
||||
var urls sectorstorage.URLs
|
||||
urls = append(urls, "http://"+ip+"/remote") // TODO: This makes assumptions, and probably bad ones too
|
||||
|
@ -2,8 +2,9 @@ package config
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"github.com/filecoin-project/sector-storage"
|
||||
"time"
|
||||
|
||||
sectorstorage "github.com/filecoin-project/sector-storage"
|
||||
)
|
||||
|
||||
// Common is common config between full node and miner
|
||||
@ -29,8 +30,9 @@ type StorageMiner struct {
|
||||
|
||||
// API contains configs for API endpoint
|
||||
type API struct {
|
||||
ListenAddress string
|
||||
Timeout Duration
|
||||
ListenAddress string
|
||||
RemoteListenAddress string
|
||||
Timeout Duration
|
||||
}
|
||||
|
||||
// Libp2p contains configs for libp2p
|
||||
@ -55,8 +57,9 @@ type Metrics struct {
|
||||
func defCommon() Common {
|
||||
return Common{
|
||||
API: API{
|
||||
ListenAddress: "/ip4/127.0.0.1/tcp/1234/http",
|
||||
Timeout: Duration(30 * time.Second),
|
||||
ListenAddress: "/ip4/127.0.0.1/tcp/1234/http",
|
||||
RemoteListenAddress: "127.0.0.1:1234",
|
||||
Timeout: Duration(30 * time.Second),
|
||||
},
|
||||
Libp2p: Libp2p{
|
||||
ListenAddresses: []string{
|
||||
|
Loading…
Reference in New Issue
Block a user