Skip to content

Commit

Permalink
Added block headers import
Browse files Browse the repository at this point in the history
  • Loading branch information
icellan committed Apr 20, 2022
1 parent 482329c commit a81e358
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
42 changes: 22 additions & 20 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,28 @@ type (

// AppConfig is the configuration values and associated env vars
AppConfig struct {
Authentication *AuthenticationConfig `json:"authentication" mapstructure:"authentication"`
Cachestore *CachestoreConfig `json:"cache" mapstructure:"cache"`
Datastore *DatastoreConfig `json:"datastore" mapstructure:"datastore"`
Debug bool `json:"debug" mapstructure:"debug"`
DebugProfiling bool `json:"debug_profiling" mapstructure:"debug_profiling"`
DisableITC bool `json:"disable_itc" mapstructure:"disable_itc"`
Environment string `json:"environment" mapstructure:"environment"`
GDPRCompliance bool `json:"gdpr_compliance" mapstructure:"gdpr_compliance"`
GraphQL *GraphqlConfig `json:"graphql" mapstructure:"graphql"`
Mongo *datastore.MongoDBConfig `json:"mongodb" mapstructure:"mongodb"`
Monitor *MonitorOptions `json:"monitor" mapstructure:"monitor"`
NewRelic *NewRelicConfig `json:"new_relic" mapstructure:"new_relic"`
Authentication *AuthenticationConfig `json:"authentication" mapstructure:"authentication"`
Cachestore *CachestoreConfig `json:"cache" mapstructure:"cache"`
Datastore *DatastoreConfig `json:"datastore" mapstructure:"datastore"`
Debug bool `json:"debug" mapstructure:"debug"`
DebugProfiling bool `json:"debug_profiling" mapstructure:"debug_profiling"`
DisableITC bool `json:"disable_itc" mapstructure:"disable_itc"`
Environment string `json:"environment" mapstructure:"environment"`
GDPRCompliance bool `json:"gdpr_compliance" mapstructure:"gdpr_compliance"`
GraphQL *GraphqlConfig `json:"graphql" mapstructure:"graphql"`
ImportBlockHeaders string `json:"import_block_headers" mapstructure:"import_block_headers"`
Mongo *datastore.MongoDBConfig `json:"mongodb" mapstructure:"mongodb"`
Monitor *MonitorOptions `json:"monitor" mapstructure:"monitor"`
NewRelic *NewRelicConfig `json:"new_relic" mapstructure:"new_relic"`
Notifications *NotificationsConfig `json:"notifications" mapstructure:"notifications"`
Paymail *PaymailConfig `json:"paymail" mapstructure:"paymail"`
Redis *RedisConfig `json:"redis" mapstructure:"redis"`
RequestLogging bool `json:"request_logging" mapstructure:"request_logging"`
Server *ServerConfig `json:"server" mapstructure:"server"`
SQL *datastore.SQLConfig `json:"sql" mapstructure:"sql"`
SQLite *datastore.SQLiteConfig `json:"sqlite" mapstructure:"sqlite"`
TaskManager *TaskManagerConfig `json:"task_manager" mapstructure:"task_manager"`
WorkingDirectory string `json:"working_directory" mapstructure:"working_directory"`
Paymail *PaymailConfig `json:"paymail" mapstructure:"paymail"`
Redis *RedisConfig `json:"redis" mapstructure:"redis"`
RequestLogging bool `json:"request_logging" mapstructure:"request_logging"`
Server *ServerConfig `json:"server" mapstructure:"server"`
SQL *datastore.SQLConfig `json:"sql" mapstructure:"sql"`
SQLite *datastore.SQLiteConfig `json:"sqlite" mapstructure:"sqlite"`
TaskManager *TaskManagerConfig `json:"task_manager" mapstructure:"task_manager"`
WorkingDirectory string `json:"working_directory" mapstructure:"working_directory"`
}

// AuthenticationConfig is the configuration for Authentication
Expand Down Expand Up @@ -98,6 +99,7 @@ type (

// MonitorOptions is the configuration for blockchain monitoring
MonitorOptions struct {
Debug bool `json:"debug" mapstructure:"debug"` // true/false
Enabled bool `json:"enabled" mapstructure:"enabled"` // true/false
CentrifugeServer string `json:"centrifuge_server" mapstructure:"centrifuge_server"` // The server url address
Token string `json:"token" mapstructure:"token"` // Token to connect to the server with
Expand Down
6 changes: 6 additions & 0 deletions config/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ func (s *AppServices) loadBux(ctx context.Context, appConfig *AppConfig) (err er
options = append(options, bux.WithITCDisabled())
}

// Set if the feature is disabled
if appConfig.ImportBlockHeaders != "" {
options = append(options, bux.WithImportBlockHeaders(appConfig.ImportBlockHeaders))
}

// todo: customize the logger

// todo: feature: override the config from JSON env (side-load your own /envs/custom-config.json
Expand Down Expand Up @@ -210,6 +215,7 @@ func (s *AppServices) loadBux(ctx context.Context, appConfig *AppConfig) (err er
return
}
options = append(options, bux.WithMonitoring(ctx, &chainstate.MonitorOptions{
Debug: appConfig.Monitor.Debug,
CentrifugeServer: appConfig.Monitor.CentrifugeServer,
MonitorDays: appConfig.Monitor.MonitorDays,
Token: appConfig.Monitor.Token,
Expand Down

0 comments on commit a81e358

Please sign in to comment.