Skip to content

Commit

Permalink
fix: code climate warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos committed Apr 22, 2022
1 parent 1e29948 commit d21b89c
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions api/geth_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,22 @@ func (b *GethStatusBackend) ensureAppDBOpened(account multiaccounts.Account, pas
return nil
}

func (b *GethStatusBackend) setupLogSettings() error {
logSettings := logutils.LogSettings{
Enabled: b.config.LogEnabled,
MobileSystem: b.config.LogMobileSystem,
Level: b.config.LogLevel,
File: b.config.LogFile,
MaxSize: b.config.LogMaxSize,
MaxBackups: b.config.LogMaxBackups,
CompressRotated: b.config.LogCompressRotated,
}
if err := logutils.OverrideRootLogWithConfig(logSettings, false); err != nil {
return err
}
return nil
}

// StartNodeWithKey instead of loading addresses from database this method derives address from key
// and uses it in application.
// TODO: we should use a proper struct with optional values instead of duplicating the regular functions
Expand All @@ -281,20 +297,13 @@ func (b *GethStatusBackend) startNodeWithKey(acc multiaccounts.Account, password
return err
}

if b.loadNodeConfig(nil) != nil {
err = b.loadNodeConfig(nil)
if err != nil {
return err
}

logSettings := logutils.LogSettings{
Enabled: b.config.LogEnabled,
MobileSystem: b.config.LogMobileSystem,
Level: b.config.LogLevel,
File: b.config.LogFile,
MaxSize: b.config.LogMaxSize,
MaxBackups: b.config.LogMaxBackups,
CompressRotated: b.config.LogCompressRotated,
}
if err := logutils.OverrideRootLogWithConfig(logSettings, false); err != nil {
err = b.setupLogSettings()
if err != nil {
return err
}

Expand Down Expand Up @@ -372,18 +381,11 @@ func (b *GethStatusBackend) startNodeWithAccount(acc multiaccounts.Account, pass
return err
}

logSettings := logutils.LogSettings{
Enabled: b.config.LogEnabled,
MobileSystem: b.config.LogMobileSystem,
Level: b.config.LogLevel,
File: b.config.LogFile,
MaxSize: b.config.LogMaxSize,
MaxBackups: b.config.LogMaxBackups,
CompressRotated: b.config.LogCompressRotated,
}
if err := logutils.OverrideRootLogWithConfig(logSettings, false); err != nil {
err = b.setupLogSettings()
if err != nil {
return err
}

b.account = &acc
accountsDB, err := accounts.NewDB(b.appDB)
if err != nil {
Expand Down

0 comments on commit d21b89c

Please sign in to comment.