refactor: warning when bootstrap disabled by user
https://github.com/ipfs/go-ipfs/pull/8166#discussion_r646711067 (cherry picked from commit 904cc737162eed91ff5a172ac65c758387da9100)
Marcin Rataj committed
Jun 7, 2021 at 18:14 UTC
7bba2a6434f008847d150eb3a3097addba298f3c
1 file changed
+10
cmd/ipfs/daemon.go
+10
@@ -515,6 +515,16 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
515
// Give the user heads up if daemon running in online mode has no peers after 1 minute
516
if !offline {
517
time.AfterFunc(1*time.Minute, func() {
518
+ cfg, err := cctx.GetConfig()
519
+ if err != nil {
520
+ log.Errorf("failed to access config: %s", err)
521
+ }
522
+ if len(cfg.Bootstrap) == 0 && len(cfg.Peering.Peers) == 0 {
523
+ // Skip peer check if Bootstrap and Peering lists are empty
524
+ // (means user disabled them on purpose)
525
+ log.Warn("skipping bootstrap: empty Bootstrap and Peering lists")
526
+ return
527
+ }
528
ipfs, err := coreapi.NewCoreAPI(node)
529
if err != nil {
530
log.Errorf("failed to access CoreAPI: %v", err)