From 31813a91d27f62cabe06e8796184953e1c9e920b Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Wed, 5 Jul 2023 10:27:10 +0200 Subject: [PATCH] fix: disable pubsub by default on ipfs node Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com> --- pkg/ipfsutil/mobile.go | 10 ++++++++++ service.go | 6 +----- service_client.go | 6 +----- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pkg/ipfsutil/mobile.go b/pkg/ipfsutil/mobile.go index f2af4e9a..6f88c4a7 100644 --- a/pkg/ipfsutil/mobile.go +++ b/pkg/ipfsutil/mobile.go @@ -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) { diff --git a/service.go b/service.go index aaea73ba..57942a65 100644 --- a/service.go +++ b/service.go @@ -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 } diff --git a/service_client.go b/service_client.go index d02aa1ad..8b7e1301 100644 --- a/service_client.go +++ b/service_client.go @@ -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 }