General engine improvements (#437)

* Add exchange manager to engine

* Several improvements for engine and friends

1) New file.Exists func
2) gRPC TLS cert expiration date check and regeneration
3) New donation var for use across the codebase
4) Use Go log package until the logger is initialised

* Add cert tests and create dir tree if it doesn't exist for file.Write

* Link up donation address to documentation tool plus minor adjustments

* Fix remaining donation addrs

* Move non-needed reload exchange funcs

* Revert accidental config_example.json changes 🕯️

* Use go logger for logging until the logger has initiliased, otherwise no output will be seen

* Link up portfolio delay val and other fixes

* Run go mod tidy after dependabot PR

* Address nitterinos
This commit is contained in:
Adrian Gallagher
2020-02-06 12:32:01 +11:00
committed by GitHub
parent 2e6ff1c398
commit b949388994
186 changed files with 922 additions and 604 deletions

View File

@@ -9,10 +9,10 @@ import (
"errors"
"fmt"
"io"
"log"
"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/common/crypto"
log "github.com/thrasher-corp/gocryptotrader/logger"
"golang.org/x/crypto/scrypt"
)
@@ -35,7 +35,7 @@ var (
// PromptForConfigEncryption asks for encryption key
func (c *Config) PromptForConfigEncryption(configPath string, dryrun bool) bool {
fmt.Println("Would you like to encrypt your config file (y/n)?")
log.Println("Would you like to encrypt your config file (y/n)?")
input := ""
_, err := fmt.Scanln(&input)
@@ -47,7 +47,7 @@ func (c *Config) PromptForConfigEncryption(configPath string, dryrun bool) bool
c.EncryptConfig = fileEncryptionDisabled
err := c.SaveConfig(configPath, dryrun)
if err != nil {
log.Errorf(log.ConfigMgr, "cannot save config %s", err)
log.Printf("Cannot save config. Error: %s\n", err)
}
return false
}
@@ -59,7 +59,7 @@ func PromptForConfigKey(initialSetup bool) ([]byte, error) {
var cryptoKey []byte
for {
fmt.Println("Please enter in your password: ")
log.Println("Please enter in your password: ")
pwPrompt := func(i *[]byte) error {
_, err := fmt.Scanln(i)
return err
@@ -77,7 +77,7 @@ func PromptForConfigKey(initialSetup bool) ([]byte, error) {
}
var p2 []byte
fmt.Println("Please re-enter your password: ")
log.Println("Please re-enter your password: ")
err = pwPrompt(&p2)
if err != nil {
return nil, err
@@ -87,7 +87,7 @@ func PromptForConfigKey(initialSetup bool) ([]byte, error) {
cryptoKey = p1
break
}
fmt.Printf("Passwords did not match, please try again.")
log.Println("Passwords did not match, please try again.")
}
return cryptoKey, nil
}