Documentation ¶
Index ¶
- Variables
- func BindFlagsLoadViper(cmd *cobra.Command, _ []string) error
- func GetConfigFilePath() string
- func RemoveDuplicates(s []string) []string
- func ToNullString(value string) sql.NullString
- func WatchMethod(method func() error)
- func Write(cfg Config, path string) error
- type CobraCmdFunc
- type Config
- type ConfigParser
Constants ¶
This section is empty.
Variables ¶
var (
HomePath = ""
)
Functions ¶
func BindFlagsLoadViper ¶
BindFlagsLoadViper binds all flags and read the config into viper
func GetConfigFilePath ¶
func GetConfigFilePath() string
GetConfigFilePath returns the path to the configuration file given the executable name
func RemoveDuplicates ¶
RemoveDuplicates function removes duplicate values
func ToNullString ¶
func ToNullString(value string) sql.NullString
ToNullString converts to empty string
func WatchMethod ¶
func WatchMethod(method func() error)
WatchMethod allows to watch for a method that returns an error. It executes the given method in a goroutine, logging any error that might raise.
Types ¶
type CobraCmdFunc ¶
CobraCmdFunc represents a cobra command function
func ConcatCobraCmdFuncs ¶
func ConcatCobraCmdFuncs(fs ...CobraCmdFunc) CobraCmdFunc
ConcatCobraCmdFuncs returns a single function that calls each argument function in sequence RunE, PreRunE, PersistentPreRunE, etc. all have this same signature
type Config ¶
type Config struct { API apiconfig.Config `yaml:"api"` Database databaseconfig.DatabaseConfig `yaml:"database"` Parser parserconfig.ParserConfig `yaml:"parser"` // contains filtered or unexported fields }
Config defines all necessary IBCJuno configuration parameters.
var ( // Cfg represents the configuration used during the execution Cfg Config )
func DefaultConfigParser ¶
DefaultConfigParser reads and parse IBCJuno config from the given string bytes. An error reading or parsing the config results in a panic.
func NewConfig ¶
func NewConfig( api apiconfig.Config, dbConfig databaseconfig.DatabaseConfig, parserConfig parserconfig.ParserConfig, ) Config
NewConfig builds new Config instance
type ConfigParser ¶
ConfigParser represents a function that allows to parse config file contents as a Config object