Skip to content

Commit

Permalink
fix: disable pubsub by default on ipfs node
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Jul 6, 2023
1 parent f6eff43 commit 31813a9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
10 changes: 10 additions & 0 deletions pkg/ipfsutil/mobile.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ func (o *MobileOptions) fillDefault() {
if o.IpfsConfigPatch == nil {
o.IpfsConfigPatch = defaultIpfsConfigPatch
}

// apply default extras
if o.ExtraOpts == nil {
o.ExtraOpts = make(map[string]bool)
}

// if not set, disable pubsub by default to avoid collision
if _, ok := o.ExtraOpts["pubsub"]; !ok {
o.ExtraOpts["pubsub"] = false
}
}

func NewIPFSMobile(ctx context.Context, repo *ipfs_mobile.RepoMobile, opts *MobileOptions) (*ipfs_mobile.IpfsMobile, error) {
Expand Down
6 changes: 1 addition & 5 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,7 @@ func (opts *Opts) applyDefaults(ctx context.Context) error {
}

mrepo := ipfs_mobile.NewRepoMobile("", repo)
mnode, err = ipfsutil.NewIPFSMobile(ctx, mrepo, &ipfsutil.MobileOptions{
ExtraOpts: map[string]bool{
"pubsub": false,
},
})
mnode, err = ipfsutil.NewIPFSMobile(ctx, mrepo, &ipfsutil.MobileOptions{})
if err != nil {
return err
}
Expand Down
6 changes: 1 addition & 5 deletions service_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ func NewPersistentServiceClient(path string) (ServiceClient, error) {
}

mrepo := ipfs_mobile.NewRepoMobile(path, repo)
mnode, err := ipfsutil.NewIPFSMobile(context.TODO(), mrepo, &ipfsutil.MobileOptions{
ExtraOpts: map[string]bool{
"pubsub": true,
},
})
mnode, err := ipfsutil.NewIPFSMobile(context.TODO(), mrepo, &ipfsutil.MobileOptions{})
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 31813a9

Please sign in to comment.