Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 61a4b9e

Browse files
committed
Configure web relays from config file
1 parent c0d071c commit 61a4b9e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

cmd/start.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ func (x *Start) Execute(args []string) error {
240240
log.Error("scan data sharing config:", err)
241241
return err
242242
}
243+
webRelays, err := schema.GetWebRelays(configFile)
244+
if err != nil {
245+
log.Error("scan web relays config:", err)
246+
return err
247+
}
243248
dropboxToken, err := schema.GetDropboxApiToken(configFile)
244249
if err != nil {
245250
log.Error("scan dropbox api token:", err)
@@ -587,6 +592,8 @@ func (x *Start) Execute(args []string) error {
587592
subscriber := ipfs.NewPubsubSubscriber(context.Background(), nd.PeerHost, nd.Routing, nd.Repo.Datastore(), nd.PubSub)
588593
ps := ipfs.Pubsub{Publisher: publisher, Subscriber: subscriber}
589594

595+
wm := obnet.NewWebRelayManager(webRelays, identity.PeerID)
596+
590597
// OpenBazaar node setup
591598
core.Node = &core.OpenBazaarNode{
592599
AcceptStoreRequests: dataSharing.AcceptStoreRequests,
@@ -599,6 +606,7 @@ func (x *Start) Execute(args []string) error {
599606
OfflineMessageFailoverTimeout: 30 * time.Second,
600607
Pubsub: ps,
601608
PushNodes: pushNodes,
609+
WebRelayManager: wm,
602610
RegressionTestEnable: x.Regtest,
603611
RepoPath: repoPath,
604612
RootHash: string(ourIpnsRecord.Value),

mobile/node.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ func NewNodeWithConfig(config *NodeConfig, password string, mnemonic string) (*N
155155
return nil, err
156156
}
157157

158+
webRelays, err := apiSchema.GetWebRelays(configFile)
159+
if err != nil {
160+
return nil, err
161+
}
162+
158163
walletsConfig, err := apiSchema.GetWalletsConfig(configFile)
159164
if err != nil {
160165
return nil, err
@@ -279,6 +284,8 @@ func NewNodeWithConfig(config *NodeConfig, password string, mnemonic string) (*N
279284
pushNodes = append(pushNodes, p)
280285
}
281286

287+
wm := obnet.NewWebRelayManager(webRelays, identity.PeerID)
288+
282289
// OpenBazaar node setup
283290
node := &core.OpenBazaarNode{
284291
BanManager: bm,
@@ -287,6 +294,7 @@ func NewNodeWithConfig(config *NodeConfig, password string, mnemonic string) (*N
287294
Multiwallet: mw,
288295
OfflineMessageFailoverTimeout: 5 * time.Second,
289296
PushNodes: pushNodes,
297+
WebRelayManager: wm,
290298
RepoPath: config.RepoPath,
291299
UserAgent: core.USERAGENT,
292300
IPNSQuorumSize: uint(ipnsExtraConfig.DHTQuorumSize),

0 commit comments

Comments
 (0)