mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-06 15:10:59 +00:00
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:
@@ -248,4 +248,4 @@ When submitting a PR, please abide by our coding guidelines:
|
||||
|
||||
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
|
||||
|
||||
***1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB***
|
||||
***bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc***
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
@@ -1336,11 +1335,9 @@ func (c *Config) CheckConnectionMonitorConfig() {
|
||||
// Helpful for printing application usage
|
||||
func DefaultFilePath() string {
|
||||
f := filepath.Join(common.GetDefaultDataDir(runtime.GOOS), File)
|
||||
_, err := os.Stat(f)
|
||||
if os.IsNotExist(err) {
|
||||
if !file.Exists(f) {
|
||||
encFile := filepath.Join(common.GetDefaultDataDir(runtime.GOOS), EncryptedFile)
|
||||
_, err = os.Stat(encFile)
|
||||
if !os.IsNotExist(err) {
|
||||
if file.Exists(encFile) {
|
||||
return encFile
|
||||
}
|
||||
}
|
||||
@@ -1390,12 +1387,10 @@ func GetFilePath(configfile string) (string, error) {
|
||||
// First upgrade the old dir config file if it exists to the corresponding
|
||||
// new one
|
||||
for x := range oldDirs {
|
||||
_, err := os.Stat(oldDirs[x])
|
||||
if os.IsNotExist(err) {
|
||||
if !file.Exists(oldDirs[x]) {
|
||||
continue
|
||||
}
|
||||
_, err = os.Stat(newDirs[x])
|
||||
if !os.IsNotExist(err) {
|
||||
if file.Exists(newDirs[x]) {
|
||||
log.Warnf(log.ConfigMgr,
|
||||
"config.json file found in root dir and gct dir; cannot overwrite, defaulting to gct dir config.json at %s",
|
||||
newDirs[x])
|
||||
@@ -1424,8 +1419,7 @@ func GetFilePath(configfile string) (string, error) {
|
||||
|
||||
// Secondly check to see if the new config file extension is correct or not
|
||||
for x := range newDirs {
|
||||
_, err := os.Stat(newDirs[x])
|
||||
if os.IsNotExist(err) {
|
||||
if !file.Exists(newDirs[x]) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user