Documentation
¶
Overview ¶
Package config is the reporter's akash-style configuration: a TOML file at <home>/config/reporter.toml, AKT_REPORTER_* environment variables, flags and validation.
Index ¶
- Constants
- func AddFlags(fs *pflag.FlagSet)
- func FilePath(home string) string
- func Known() []string
- func Render(c Config) ([]byte, error)
- func ResolveHome(flags *pflag.FlagSet, environ []string) (string, error)
- type Config
- type ExternalSigner
- type Legacy
- type Metrics
- type Remote
- type Resolved
- type Scan
- type Signer
- type Solana
- type Tx
Constants ¶
const ( // MainnetChainID is the Akash mainnet chain ID that the mainnet network guard requires. MainnetChainID = "akashnet-2" // MainnetGenesis is the Solana mainnet genesis hash that the mainnet network guard requires. MainnetGenesis = "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d" // DevProgramID is the development program ID that the mainnet network guard refuses. DevProgramID = "FfFAPUKqjf68ggj1HvpyzMHFDRnT2cFAdZYYQb7mK9i5" // EnvPrefix is the prefix of every environment variable the reporter reads. EnvPrefix = "AKT_REPORTER" // FlagHome is the name of the home directory flag. It is not a configuration key. FlagHome = "home" )
Variables ¶
This section is empty.
Functions ¶
func AddFlags ¶
AddFlags registers one flag per key, named by the dotted key, and the home flag unless it already exists.
Types ¶
type Config ¶
type Config struct {
Legacy *Legacy `mapstructure:"-"`
Network string `mapstructure:"network"`
Broadcast bool `mapstructure:"broadcast"`
Reporter string `mapstructure:"reporter"`
ChainID string `mapstructure:"chain-id"`
Node string `mapstructure:"node"`
GRPCAddr string `mapstructure:"grpc-addr"`
GRPCInsecure bool `mapstructure:"grpc-insecure"`
MaxAge time.Duration `mapstructure:"max-age"`
RequestTimeout time.Duration `mapstructure:"request-timeout"`
From string `mapstructure:"from"`
KeyringBackend string `mapstructure:"keyring-backend"`
KeyringDir string `mapstructure:"keyring-dir"`
Gas string `mapstructure:"gas"`
GasAdjustment float64 `mapstructure:"gas-adjustment"`
GasPrices string `mapstructure:"gas-prices"`
Fees string `mapstructure:"fees"`
Solana Solana `mapstructure:"solana"`
Scan Scan `mapstructure:"scan"`
Tx Tx `mapstructure:"tx"`
Signer Signer `mapstructure:"signer"`
Metrics Metrics `mapstructure:"metrics"`
}
Config mirrors the keys of spec section 8.3. The mapstructure tags are the key names, so a key is the dotted path of its tags.
func Default ¶
func Default() Config
Default returns the defaults of spec section 8.3. Required keys are empty. KeyringDir is empty here and Load fills it with the home directory.
func Load ¶
Load reads the configuration with the precedence flag, environment, file, default. flags must come from AddFlags and be parsed. It does not validate values; see Resolve. Unknown keys in the file are errors. Unknown AKT_REPORTER_* variables are returned as warnings.
func LoadLegacy ¶
LoadLegacy reads the old packaged JSON without inspecting keys or contacting services. Resolve applies the same identity, fee, gas and broadcast safety rules as canonical input.
type ExternalSigner ¶
type ExternalSigner struct {
Options signer.CommandOptions
PublicKey cryptotypes.PubKey
}
ExternalSigner holds the legacy JSON command settings and an optional validated public key. A missing key is looked up only during broadcast startup.
type Legacy ¶
type Legacy struct {
KeyFile string
ExternalSigner *ExternalSigner
}
Legacy selects the packaged JSON input and single-Comet query transport. It is set only by LoadLegacy, never by TOML, environment or canonical flags.
type Metrics ¶
type Metrics struct {
Listen string `mapstructure:"listen"`
}
Metrics holds the metrics.* keys.
type Remote ¶
type Remote struct {
Address string `mapstructure:"address"`
KeyID string `mapstructure:"key-id"`
CAFile string `mapstructure:"ca-file"`
ServerName string `mapstructure:"server-name"`
CertFile string `mapstructure:"cert-file"`
KeyFile string `mapstructure:"key-file"`
Timeout time.Duration `mapstructure:"timeout"`
}
Remote holds the signer.remote.* keys.
type Resolved ¶
type Resolved struct {
Config
ProgramID, Mint solana.PublicKey
// LightClientPin is nil when solana.light-client-program is empty, which follows the bridge account.
LightClientPin *solana.PublicKey
Reporter sdk.AccAddress
// SlotLead is solana.max-slot-lead or, when that is 0, (max-age + 60 s) rounded up to whole seconds, x 5.
SlotLead uint64
// GasPerMessage is 0 for gas = auto.
GasPerMessage uint64
// GasPrices is empty when only fees is set.
GasPrices sdk.DecCoins
// Fees is empty when fees is unset or explicitly zero in legacy JSON.
Fees sdk.Coins
MaxFee sdk.Coin
}
Resolved is a validated Config with its derived values parsed.
type Scan ¶
type Scan struct {
Interval time.Duration `mapstructure:"interval"`
AuditPerScan int `mapstructure:"audit-per-scan"`
PageSize int `mapstructure:"page-size"`
Workers int `mapstructure:"workers"`
AkashConcurrency int `mapstructure:"akash-concurrency"`
SolanaConcurrency int `mapstructure:"solana-concurrency"`
BlockConcurrency int `mapstructure:"block-concurrency"`
}
Scan holds the scan.* keys.
type Signer ¶
type Signer struct {
Remote Remote `mapstructure:"remote"`
}
Signer holds the signer.* keys.
type Solana ¶
type Solana struct {
RPC string `mapstructure:"rpc"`
GenesisHash string `mapstructure:"genesis-hash"`
ProgramID string `mapstructure:"program-id"`
Mint string `mapstructure:"mint"`
LightClientProgram string `mapstructure:"light-client-program"`
MaxSlotLead uint64 `mapstructure:"max-slot-lead"`
}
Solana holds the solana.* keys.