cmd

package
v0.0.0-...-5fc2af4 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RootCmd = &cobra.Command{
		Use:   "meminero",
		Short: "Ethereum data and indexer",
		Long:  "Scrape ethereum data from any web3-compatible node and index it into a postgres database",
		PersistentPreRun: func(cmd *cobra.Command, args []string) {
			err := viper.BindPFlags(cmd.Flags())
			if err != nil {
				log.Fatal(err)
			}

			if configFile != "" {

				abs, err := filepath.Abs(configFile)
				if err != nil {
					log.Error("Error reading filepath: ", err.Error())
				}

				base := filepath.Base(abs)

				path := filepath.Dir(abs)

				viper.SetConfigName(strings.Split(base, ".")[0])
				viper.AddConfigPath(path)
			}

			viper.AddConfigPath(".")

			if err := viper.ReadInConfig(); err != nil {
				log.Info("Could not load config file. Falling back to args. Error: ", err)
			}

			initLogging()
			buildDBConnectionString()

			config.Load()
		},

		Run: func(cmd *cobra.Command, args []string) {

			cmd.HelpFunc()(cmd, args)
		},
	}
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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