Add config for durable store
This commit is contained in:
parent
8045b4cfbb
commit
de0ba7fea6
@ -44,6 +44,8 @@ func addNitroFlags(command *cobra.Command) {
|
|||||||
command.PersistentFlags().String("nitro-naAddress", "", "nitro naAddress")
|
command.PersistentFlags().String("nitro-naAddress", "", "nitro naAddress")
|
||||||
command.PersistentFlags().String("nitro-vpaAddress", "", "nitro vpaAddress")
|
command.PersistentFlags().String("nitro-vpaAddress", "", "nitro vpaAddress")
|
||||||
command.PersistentFlags().String("nitro-caAddress", "", "nitro caAddress")
|
command.PersistentFlags().String("nitro-caAddress", "", "nitro caAddress")
|
||||||
|
command.PersistentFlags().Bool("nitro-useDurableStore", false, "nitro useDurableStore")
|
||||||
|
command.PersistentFlags().String("nitro-durableStoreFolder", "", "nitro durableStoreFolder")
|
||||||
|
|
||||||
// nitro flag bindings
|
// nitro flag bindings
|
||||||
viper.BindPFlag("nitro.pk", command.PersistentFlags().Lookup("nitro-pk"))
|
viper.BindPFlag("nitro.pk", command.PersistentFlags().Lookup("nitro-pk"))
|
||||||
@ -52,4 +54,6 @@ func addNitroFlags(command *cobra.Command) {
|
|||||||
viper.BindPFlag("nitro.naAddress", command.PersistentFlags().Lookup("nitro-naAddress"))
|
viper.BindPFlag("nitro.naAddress", command.PersistentFlags().Lookup("nitro-naAddress"))
|
||||||
viper.BindPFlag("nitro.vpaAddress", command.PersistentFlags().Lookup("nitro-vpaAddress"))
|
viper.BindPFlag("nitro.vpaAddress", command.PersistentFlags().Lookup("nitro-vpaAddress"))
|
||||||
viper.BindPFlag("nitro.caAddress", command.PersistentFlags().Lookup("nitro-caAddress"))
|
viper.BindPFlag("nitro.caAddress", command.PersistentFlags().Lookup("nitro-caAddress"))
|
||||||
|
viper.BindPFlag("nitro.useDurableStore", command.PersistentFlags().Lookup("nitro-useDurableStore"))
|
||||||
|
viper.BindPFlag("nitro.durableStoreFolder", command.PersistentFlags().Lookup("nitro-durableStoreFolder"))
|
||||||
}
|
}
|
||||||
|
@ -392,8 +392,8 @@ func init() {
|
|||||||
func initializeNitroNode(nitroConfig *s.NitroConfig) (*nitroNode.Node, error) {
|
func initializeNitroNode(nitroConfig *s.NitroConfig) (*nitroNode.Node, error) {
|
||||||
// TODO: Configure
|
// TODO: Configure
|
||||||
pkString := nitroConfig.Pk
|
pkString := nitroConfig.Pk
|
||||||
useDurableStore := true
|
useDurableStore := nitroConfig.UseDurableStore
|
||||||
durableStoreFolder := "./data/nitro-store"
|
durableStoreFolder := nitroConfig.DurableStoreFolder
|
||||||
msgPort := 3005
|
msgPort := 3005
|
||||||
wsMsgPort := 5005
|
wsMsgPort := 5005
|
||||||
chainUrl := nitroConfig.ChainUrl
|
chainUrl := nitroConfig.ChainUrl
|
||||||
|
@ -39,3 +39,5 @@
|
|||||||
naAddress = ""
|
naAddress = ""
|
||||||
vpaAddress = ""
|
vpaAddress = ""
|
||||||
caAddress = ""
|
caAddress = ""
|
||||||
|
useDurableStore = false # NITRO_USE_DURABLE_STORE
|
||||||
|
durableStoreFolder = "" # NITRO_DURABLE_STORE_FOLDER
|
||||||
|
@ -80,21 +80,25 @@ const (
|
|||||||
DATABASE_MAX_OPEN_CONNECTIONS = "DATABASE_MAX_OPEN_CONNECTIONS"
|
DATABASE_MAX_OPEN_CONNECTIONS = "DATABASE_MAX_OPEN_CONNECTIONS"
|
||||||
DATABASE_MAX_CONN_LIFETIME = "DATABASE_MAX_CONN_LIFETIME"
|
DATABASE_MAX_CONN_LIFETIME = "DATABASE_MAX_CONN_LIFETIME"
|
||||||
|
|
||||||
NITRO_PK = "NITRO_PK"
|
NITRO_PK = "NITRO_PK"
|
||||||
NITRO_CHAIN_PK = "NITRO_CHAIN_PK"
|
NITRO_CHAIN_PK = "NITRO_CHAIN_PK"
|
||||||
NITRO_CHAIN_URL = "NITRO_CHAIN_URL"
|
NITRO_CHAIN_URL = "NITRO_CHAIN_URL"
|
||||||
NITRO_NA_ADDRESS = "NITRO_NA_ADDRESS"
|
NITRO_NA_ADDRESS = "NITRO_NA_ADDRESS"
|
||||||
NITRO_VPA_ADDRESS = "NITRO_VPA_ADDRESS"
|
NITRO_VPA_ADDRESS = "NITRO_VPA_ADDRESS"
|
||||||
NITRO_CA_ADDRESS = "NITRO_CA_ADDRESS"
|
NITRO_CA_ADDRESS = "NITRO_CA_ADDRESS"
|
||||||
|
NITRO_USE_DURABLE_STORE = "NITRO_USE_DURABLE_STORE"
|
||||||
|
NITRO_DURABLE_STORE_FOLDER = "NITRO_DURABLE_STORE_FOLDER"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NitroConfig struct {
|
type NitroConfig struct {
|
||||||
Pk string
|
Pk string
|
||||||
ChainPk string
|
ChainPk string
|
||||||
ChainUrl string
|
ChainUrl string
|
||||||
NaAddress string
|
NaAddress string
|
||||||
VpaAddress string
|
VpaAddress string
|
||||||
CaAddress string
|
CaAddress string
|
||||||
|
UseDurableStore bool
|
||||||
|
DurableStoreFolder string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config struct
|
// Config struct
|
||||||
@ -309,6 +313,8 @@ func (c *Config) loadNitroConfig() {
|
|||||||
viper.BindEnv("nitro.naAddress", NITRO_NA_ADDRESS)
|
viper.BindEnv("nitro.naAddress", NITRO_NA_ADDRESS)
|
||||||
viper.BindEnv("nitro.vpaAddress", NITRO_VPA_ADDRESS)
|
viper.BindEnv("nitro.vpaAddress", NITRO_VPA_ADDRESS)
|
||||||
viper.BindEnv("nitro.caAddress", NITRO_CA_ADDRESS)
|
viper.BindEnv("nitro.caAddress", NITRO_CA_ADDRESS)
|
||||||
|
viper.BindEnv("nitro.useDurableStore", NITRO_USE_DURABLE_STORE)
|
||||||
|
viper.BindEnv("nitro.durableStoreFolder", NITRO_DURABLE_STORE_FOLDER)
|
||||||
|
|
||||||
c.Nitro.Pk = viper.GetString("nitro.pk")
|
c.Nitro.Pk = viper.GetString("nitro.pk")
|
||||||
c.Nitro.ChainPk = viper.GetString("nitro.chainPk")
|
c.Nitro.ChainPk = viper.GetString("nitro.chainPk")
|
||||||
@ -316,6 +322,8 @@ func (c *Config) loadNitroConfig() {
|
|||||||
c.Nitro.NaAddress = viper.GetString("nitro.naAddress")
|
c.Nitro.NaAddress = viper.GetString("nitro.naAddress")
|
||||||
c.Nitro.VpaAddress = viper.GetString("nitro.vpaAddress")
|
c.Nitro.VpaAddress = viper.GetString("nitro.vpaAddress")
|
||||||
c.Nitro.CaAddress = viper.GetString("nitro.caAddress")
|
c.Nitro.CaAddress = viper.GetString("nitro.caAddress")
|
||||||
|
c.Nitro.UseDurableStore = viper.GetBool("nitro.useDurableStore")
|
||||||
|
c.Nitro.DurableStoreFolder = viper.GetString("nitro.durableStoreFolder")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) loadGroupCacheConfig() {
|
func (c *Config) loadGroupCacheConfig() {
|
||||||
|
Loading…
Reference in New Issue
Block a user