Skip to content

Commit

Permalink
Merge pull request ethereum#214 from maticnetwork/ferran/feature-conf…
Browse files Browse the repository at this point in the history
…ig-file

Feature to add a config file to Bor
  • Loading branch information
ferranbt authored Oct 25, 2021
2 parents b797f25 + 51de433 commit 7bb4884
Show file tree
Hide file tree
Showing 8 changed files with 419 additions and 137 deletions.
14 changes: 7 additions & 7 deletions command/server/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type Command struct {
// final configuration
config *Config

configFile string
configFile []string

// bor node
node *node.Node
Expand Down Expand Up @@ -65,8 +65,8 @@ func (c *Command) Run(args []string) int {

// read config file
config := DefaultConfig()
if c.configFile != "" {
cfg, err := readConfigFile(c.configFile)
for _, configFile := range c.configFile {
cfg, err := readConfigFile(configFile)
if err != nil {
c.UI.Error(err.Error())
return 1
Expand Down Expand Up @@ -130,8 +130,8 @@ func (c *Command) Run(args []string) int {
}

// register ethash service
if config.EthStats != "" {
if err := ethstats.New(stack, backend.APIBackend, backend.Engine(), config.EthStats); err != nil {
if config.Ethstats != "" {
if err := ethstats.New(stack, backend.APIBackend, backend.Engine(), config.Ethstats); err != nil {
c.UI.Error(err.Error())
return 1
}
Expand Down Expand Up @@ -165,7 +165,7 @@ func (c *Command) Run(args []string) int {
}
}

if err := c.setupMetrics(config.Metrics); err != nil {
if err := c.setupTelemetry(config.Telemetry); err != nil {
c.UI.Error(err.Error())
return 1
}
Expand Down Expand Up @@ -221,7 +221,7 @@ func (c *Command) unlockAccounts(borKeystore *keystore.KeyStore) error {
return nil
}

func (c *Command) setupMetrics(config *MetricsConfig) error {
func (c *Command) setupTelemetry(config *TelemetryConfig) error {
metrics.Enabled = config.Enabled
metrics.EnabledExpensive = config.Expensive

Expand Down
Loading

0 comments on commit 7bb4884

Please sign in to comment.