github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/pkg/config/pinningGroup.go (about)

     1  // Copyright 2021 The TrueBlocks Authors. All rights reserved.
     2  // Use of this source code is governed by a license that can
     3  // be found in the LICENSE file.
     4  
     5  package config
     6  
     7  import (
     8  	"strings"
     9  
    10  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes"
    11  	shell "github.com/ipfs/go-ipfs-api"
    12  )
    13  
    14  const defaultIpfsGateway = "https://ipfs.unchainedindex.io/ipfs/"
    15  
    16  func GetPinning() configtypes.PinningGroup {
    17  	return GetRootConfig().Pinning
    18  }
    19  
    20  func IpfsRunning() bool {
    21  	sh := shell.NewShell(GetPinning().LocalPinUrl)
    22  	_, err := sh.Add(strings.NewReader("hello world!"))
    23  	return err == nil
    24  }