config

package
v0.0.0-...-ca15858 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2025 License: GPL-3.0 Imports: 25 Imported by: 6

Documentation

Overview

Package config reads and manages configuration files

Index

Constants

This section is empty.

Variables

View Source
var SpecTags = map[string]string{
	"trueblocks-core@v0.40.0":        "QmUou7zX2g2tY58LP1A2GyP5RF9nbJsoxKTp299ah3svgb",
	"trueblocks-core@v2.0.0-release": "QmUyyU8wKW57c3CuwphhMdZb2QA5bsjt9vVfTE6LcBKmE9",
}

SpecTags allows us to go from a version string to an IPFS hash pointing to the spec

View Source
var VersionTags = map[string]string{
	"0x81ae14ba68e372bc9bd4a295b844abd8e72b1de10fcd706e624647701d911da1": "trueblocks-core@v0.40.0",
	"0x6fc0c6dd027719f456c1e50a329f6157767325aa937411fa6e7be9359d9e0046": "trueblocks-core@v2.0.0-release",
}

VersionTags allows us to go from the version bytes found in the chunks to a version string

Functions

func EstablishCachePaths

func EstablishCachePaths(cachePath string)

EstablishCachePaths sets up the cache folders and subfolders. It only returns if it succeeds.

func EstablishIndexPaths

func EstablishIndexPaths(indexPath string)

EstablishIndexPaths sets up the index path and subfolders. It only returns if it succeeds.

func ExpectedVersion

func ExpectedVersion() string

func GetChain

func GetChain(chain string) configtypes.ChainGroup

GetChain returns the chain for a given chain

func GetChains

func GetChains() []configtypes.ChainGroup

GetChains returns a list of all chains configured in the config file. Note, there is no "official" list. Users may add their own chains.

func GetKey

func GetKey(set string) configtypes.KeyGroup

func GetPinning

func GetPinning() configtypes.PinningGroup

func GetPublisher

func GetPublisher(value string) string

func GetRootConfig

func GetRootConfig() *configtypes.Config

GetRootConfig reads and the configuration located in trueBlocks.toml file. Note that this routine is local to the package

func GetScrape

func GetScrape(chain string) configtypes.ScrapeSettings

GetScrape returns the scraper settings per chain

func GetSettings

func GetSettings() configtypes.SettingsGroup

func GetUnchained

func GetUnchained() configtypes.UnchainedGroup

func GetVersion

func GetVersion() configtypes.VersionGroup

func HeaderHash

func HeaderHash(version string) []byte

func IpfsRunning

func IpfsRunning() bool

func IsChainConfigured

func IsChainConfigured(needle string) bool

IsChainConfigured returns true if the chain is configured in the config file.

func KnownVersionTag

func KnownVersionTag(tag string) bool

func MergeScrapeConfig

func MergeScrapeConfig(fn string, scrape *configtypes.ScrapeSettings) error

func MustGetPathToChainConfig

func MustGetPathToChainConfig(chain string) string

MustGetPathToChainConfig returns the chain-specific config folder ignoring errors

func PathToCache

func PathToCache(chain string) string

PathToCache returns the one and only cachePath

func PathToChainConfig

func PathToChainConfig(chain string) (string, error)

PathToChainConfig returns the chain-specific config folder

func PathToConfigFile

func PathToConfigFile() string

PathToConfigFile returns the path where to find the configuration file

func PathToIndex

func PathToIndex(chain string) string

PathToIndex returns the one and only indexPath

func PathToManifestFile

func PathToManifestFile(chain string) string

PathToManifestFile returns the path to the manifest database per chain

func PathToRootConfig

func PathToRootConfig() string

PathToRootConfig returns the path where to find configuration files

func PathToTimestamps

func PathToTimestamps(chain string) string

PathToTimestamps returns the path to the timestamps database per chain

func ReadToml

func ReadToml(inFile string, destination interface{}) error

ReadToml reads the toml config file into the given struct

func ReloadConfig

func ReloadConfig()

ReloadConfig clears the config cache so that the next time ReadToml is called the config will reload

func SetExpectedVersion

func SetExpectedVersion(version string)

func SetScrapeArgs

func SetScrapeArgs(chain string, args map[string]string)

Types

type OldScrape

type OldScrape struct {
	Settings oldScrapeGroup `toml:"settings"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL