Documentation
¶
Index ¶
- Constants
- Variables
- func BindFlags(rootCMD *cobra.Command)
- func MergeChainConfigs(chainConfigs []map[string]interface{}, solverConfig solverConfig.SolverConfig) []map[string]interface{}
- func StartConfigWatcher(ctx context.Context, config *solverConfig.SolverConfig, ...) (<-chan struct{}, error)
- type Config
- type RawConfig
- type TokenConfig
- type TokenStore
Constants ¶
const (
ConfigWatcherInterval = time.Minute * 1
)
const EnvPrefix = "SYG"
Variables ¶
var ( // Flags for running the app StagingFlagName = "staging" ConfigFlagName = "config" KeystoreFlagName = "keystore" BlockstoreFlagName = "blockstore" FreshStartFlagName = "fresh" LatestBlockFlagName = "latest" )
Functions ¶
func MergeChainConfigs ¶ added in v1.5.0
func MergeChainConfigs(chainConfigs []map[string]interface{}, solverConfig solverConfig.SolverConfig) []map[string]interface{}
MergeChainConfigs fills in chains that are present in the shared solver config but were not manually configured, deriving their endpoint from the solver config's transport so a chain can be supported without a manual chain config entry. Manually configured fields always take precedence.
func StartConfigWatcher ¶ added in v1.1.0
func StartConfigWatcher(ctx context.Context, config *solverConfig.SolverConfig, opts []solverConfig.Option) (<-chan struct{}, error)
StartConfigWatcher starts a goroutine that periodically checks for config changes. Panics to induce a restart if the config has changed
Types ¶
type Config ¶
type Config struct {
RelayerConfig relayer.RelayerConfig
ChainConfigs []map[string]interface{}
}
func GetConfigFromENV ¶
GetConfigFromENV reads config from Env variables, validates it and parses it into config suitable for application
Properties of RelayerConfig are expected to be defined as separate Env variables where Env variable name reflects properties position in structure. Each Env variable needs to be prefixed with SYG.
For example, if you want to set Config.RelayerConfig.MpcConfig.Port this would translate to Env variable named SYG_RELAYER_MPCCONFIG_PORT.
type RawConfig ¶
type RawConfig struct {
RelayerConfig relayer.RawRelayerConfig `mapstructure:"relayer" json:"relayer"`
ChainConfigs []map[string]interface{} `mapstructure:"domains" json:"domains"`
}
type TokenConfig ¶ added in v0.2.0
type TokenStore ¶ added in v0.2.0
type TokenStore struct {
Tokens map[uint64]map[string]TokenConfig
}
func (*TokenStore) ConfigByAddress ¶ added in v0.2.0
func (s *TokenStore) ConfigByAddress(chainID uint64, address common.Address) (string, TokenConfig, error)
func (*TokenStore) ConfigBySymbol ¶ added in v0.2.0
func (s *TokenStore) ConfigBySymbol(chainID uint64, symbol string) (TokenConfig, error)