forked from cerc-io/ipld-eth-server
Setup essential Nitro config
This commit is contained in:
@@ -81,6 +81,15 @@ const (
|
||||
DATABASE_MAX_CONN_LIFETIME = "DATABASE_MAX_CONN_LIFETIME"
|
||||
)
|
||||
|
||||
type NitroConfig struct {
|
||||
Pk string
|
||||
ChainPk string
|
||||
ChainUrl string
|
||||
NaAddress string
|
||||
VpaAddress string
|
||||
CaAddress string
|
||||
}
|
||||
|
||||
// Config struct
|
||||
type Config struct {
|
||||
DB *sqlx.DB
|
||||
@@ -116,6 +125,8 @@ type Config struct {
|
||||
|
||||
StateValidationEnabled bool
|
||||
StateValidationEveryNthBlock uint64
|
||||
|
||||
Nitro *NitroConfig
|
||||
}
|
||||
|
||||
// NewConfig is used to initialize a watcher config from a .toml file
|
||||
@@ -248,6 +259,8 @@ func NewConfig() (*Config, error) {
|
||||
|
||||
c.loadValidatorConfig()
|
||||
|
||||
c.loadNitroConfig()
|
||||
|
||||
return c, err
|
||||
}
|
||||
|
||||
@@ -280,6 +293,17 @@ func (c *Config) dbInit() {
|
||||
c.DBConfig.MaxConnLifetime = time.Duration(viper.GetInt("database.maxLifetime"))
|
||||
}
|
||||
|
||||
func (c *Config) loadNitroConfig() {
|
||||
c.Nitro = &NitroConfig{}
|
||||
|
||||
c.Nitro.Pk = viper.GetString("nitro.pk")
|
||||
c.Nitro.ChainPk = viper.GetString("nitro.chainPk")
|
||||
c.Nitro.ChainUrl = viper.GetString("nitro.chainUrl")
|
||||
c.Nitro.NaAddress = viper.GetString("nitro.naAddress")
|
||||
c.Nitro.VpaAddress = viper.GetString("nitro.vpaAddress")
|
||||
c.Nitro.CaAddress = viper.GetString("nitro.caAddress")
|
||||
}
|
||||
|
||||
func (c *Config) loadGroupCacheConfig() {
|
||||
viper.BindEnv("groupcache.pool.enabled", ethServerShared.GcachePoolEnabled)
|
||||
viper.BindEnv("groupcache.pool.httpEndpoint", ethServerShared.GcachePoolHttpPath)
|
||||
|
||||
Reference in New Issue
Block a user