config

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChainID

func ChainID() string

ChainID returns the chain ID from the configuration. (default: sonr-localnet-1)

func Environment

func Environment() string

Environment returns the environment from the configuration. (default: development)

func HighwayHostAddress

func HighwayHostAddress() string

HighwayHostAddress returns the host and port of the Highway API

func HighwayRequestTimeout

func HighwayRequestTimeout() time.Duration

HighwayRequestTimeout returns the timeout for Highway API requests

func IceFireKVHost

func IceFireKVHost() string

IceFireKVHost returns the host and port of the IceFire KV store

func IceFireSQLHost

func IceFireSQLHost() string

IceFireSQLHost returns the host and port of the IceFire KV store

func IsProduction

func IsProduction() bool

IsProduction returns true if the environment is production

func JWTSigningKey

func JWTSigningKey() []byte

JWTSigningKey returns the JWT signing key

func Moniker

func Moniker() string

Moniker returns the moniker from the configuration. (default: alice)

func NodeAPIHostAddress

func NodeAPIHostAddress() string

NodeAPIHostAddress returns the host and port of the Node API

func NodeGrpcHostAddress

func NodeGrpcHostAddress() string

NodeGrpcHostAddress returns the host and port of the Node P2P

func NodeP2PHostAddress

func NodeP2PHostAddress() string

NodeP2PHostAddress returns the host and port of the Node P2P

func NodeRPCHostAddress

func NodeRPCHostAddress() string

NodeRPCHostAddress returns the host and port of the Node RPC

func ValidatorAddress

func ValidatorAddress() string

ValidatorAddress returns the validator address from the configuration.

Types

type Config

type Config struct {
	// Version is the version of the application.
	Version string `mapstructure:"version"`

	// Environment is the environment of the application.
	Environment string `mapstructure:"environment"`

	// ChainID is the chain ID of the application.
	ChainID string `mapstructure:"chain-id"`

	// BinPath is the binary path of the application.
	BinPath string `mapstructure:"bin-path"`

	// Launch is the launch settings of the application.
	Launch struct {
		// Name is the name of the current validator/node.
		Name string `mapstructure:"name"`

		// Address is the address of the current validator/node.
		Address string `mapstructure:"address"`

		// Highway is the highway settings of the application.
		Highway struct {
			// SigningKey is the signing key of the highway.
			SigningKey string `mapstructure:"signing-key"`

			// API is the API settings of the highway.
			API struct {
				Host    string `mapstructure:"host"`
				Port    int    `mapstructure:"port"`
				Timeout int    `mapstructure:"timeout"`
			} `mapstructure:"api"`

			// DB is the database settings of the highway.
			DB struct {
				IcefireKV struct {
					Host   string `mapstructure:"host"`
					Port   int    `mapstructure:"port"`
					Binary string `mapstructure:"binary"`
				} `mapstructure:"icefirekv"`
				IcefireSQL struct {
					Host   string `mapstructure:"host"`
					Port   int    `mapstructure:"port"`
					Binary string `mapstructure:"binary"`
				} `mapstructure:"icefiresql"`
			} `mapstructure:"db"`
		} `mapstructure:"highway"`

		// Node is the node settings of the application.
		Node struct {
			// API is the API settings of the node.
			API struct {
				Host string `mapstructure:"host"`
				Port int    `mapstructure:"port"`
			} `mapstructure:"api"`

			// P2P is the P2P settings of the node.
			P2P struct {
				Host string `mapstructure:"host"`
				Port int    `mapstructure:"port"`
			} `mapstructure:"p2p"`

			// RPC is the RPC settings of the node.
			RPC struct {
				Host string `mapstructure:"host"`
				Port int    `mapstructure:"port"`
			} `mapstructure:"rpc"`

			// GRPC is the GRPC settings of the node.
			GRPC struct {
				Host string `mapstructure:"host"`
				Port int    `mapstructure:"port"`
			} `mapstructure:"grpc"`
		} `mapstructure:"node"`
	} `mapstructure:"launch"`

	// Genesis is the genesis settings of the application.
	Genesis struct {
		// Accounts is the accounts settings of the genesis.
		Accounts []struct {
			Name  string   `mapstructure:"name"`
			Coins []string `mapstructure:"coins"`
		} `mapstructure:"accounts"`

		// Faucet is the faucet settings of the genesis.
		Faucet struct {
			Name  string   `mapstructure:"name"`
			Coins []string `mapstructure:"coins"`
		} `mapstructure:"faucet"`

		// Validators is the validators settings of the genesis.
		Validators []struct {
			Name   string `mapstructure:"name"`
			Bonded string `mapstructure:"bonded"`
		} `mapstructure:"validators"`
	} `mapstructure:"genesis"`
}

Config is defining a struct type named `Config`. This struct is used to store the configuration values for the application. It has various fields that correspond to different configuration parameters, such as version, chain ID, launch settings, database settings, node settings, genesis settings, etc. Each field is annotated with `mapstructure` tags, which are used to map the corresponding configuration values from a YAML file to the struct fields.

Jump to

Keyboard shortcuts

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