Skip to content

Commit

Permalink
fix(config): fix db config meta fields (#65)
Browse files Browse the repository at this point in the history
Fixes db config meta fields to conform viper
  • Loading branch information
Lazar955 authored Sep 26, 2024
1 parent 456ead6 commit bfdac0f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions config/dbconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ const (
type DBConfig struct {
// DBPath is the directory path in which the database file should be
// stored.
DBPath string `long:"dbpath" description:"The directory path in which the database file should be stored."`
DBPath string `mapstructure:"dbpath"`

// DBFileName is the name of the database file.
DBFileName string `long:"dbfilename" description:"The name of the database file."`
DBFileName string `mapstructure:"dbfilename"`

// NoFreelistSync, if true, prevents the database from syncing its
// freelist to disk, resulting in improved performance at the expense of
// increased startup time.
NoFreelistSync bool `long:"nofreelistsync" description:"Prevents the database from syncing its freelist to disk, resulting in improved performance at the expense of increased startup time."`
NoFreelistSync bool `mapstructure:"nofreelistsync"`

// AutoCompact specifies if a Bolt based database backend should be
// automatically compacted on startup (if the minimum age of the
// database file is reached). This will require additional disk space
// for the compacted copy of the database but will result in an overall
// lower database size after the compaction.
AutoCompact bool `long:"autocompact" description:"Specifies if a Bolt based database backend should be automatically compacted on startup (if the minimum age of the database file is reached). This will require additional disk space for the compacted copy of the database but will result in an overall lower database size after the compaction."`
AutoCompact bool `mapstructure:"autocompact"`

// AutoCompactMinAge specifies the minimum time that must have passed
// since a bolt database file was last compacted for the compaction to
// be considered again.
AutoCompactMinAge time.Duration `long:"autocompactminage" description:"Specifies the minimum time that must have passed since a bolt database file was last compacted for the compaction to be considered again."`
AutoCompactMinAge time.Duration `mapstructure:"autocompact"`

// DBTimeout specifies the timeout value to use when opening the wallet
// database.
DBTimeout time.Duration `long:"dbtimeout" description:"Specifies the timeout value to use when opening the wallet database."`
DBTimeout time.Duration `mapstructure:"autocompact"`
}

func DefaultDBConfig() *DBConfig {
Expand Down
4 changes: 2 additions & 2 deletions config/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ type MonitorConfig struct {
BtcConfirmationDepth uint64 `mapstructure:"btc-confirmation-depth"`
// whether to enable liveness checker
EnableLivenessChecker bool `mapstructure:"enable-liveness-checker"`

DatabaseConfig *DBConfig `mapstructure:"database-config"`
// DatabaseConfig stores lates epoch and height used for faster bootstrap
DatabaseConfig *DBConfig `mapstructure:"dbconfig"`
}

func (cfg *MonitorConfig) Validate() error {
Expand Down
5 changes: 3 additions & 2 deletions config/submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ type SubmitterConfig struct {
PollingIntervalSeconds uint `mapstructure:"polling-interval-seconds"`
// ResendIntervalSeconds defines the time (in seconds) which the submitter awaits
// before resubmitting checkpoints to BTC
ResendIntervalSeconds uint `mapstructure:"resend-interval-seconds"`
DatabaseConfig *DBConfig `mapstructure:"database-config"`
ResendIntervalSeconds uint `mapstructure:"resend-interval-seconds"`
// DatabaseConfig stores last submitted txn
DatabaseConfig *DBConfig `mapstructure:"dbconfig"`
}

func (cfg *SubmitterConfig) Validate() error {
Expand Down

0 comments on commit bfdac0f

Please sign in to comment.