Config overwrite bugfix (#363)

* Fix bug where on parsing an alternate new config it will overwrite main config.json in gct dir

* Stop movement of config.json file from root dir when a new config is parsed in

* Stop overiding config.json at gct dir with new config.json from root directory

* RM LN :D

* Fix bug where promptforconfig in config_encryption.go overwrites default config
Ensure periphery command packages do not interact or save over configuration
Ensure tests to not save over or change current testdata/config
This commit is contained in:
Ryan O'Hara-Reid
2019-09-27 16:03:41 +10:00
committed by Adrian Gallagher
parent 6bdbe236c0
commit e2d57540a6
55 changed files with 408 additions and 173 deletions

View File

@@ -2,6 +2,7 @@ package lakebtc
import (
"fmt"
"log"
"testing"
"github.com/thrasher-corp/gocryptotrader/common"
@@ -32,7 +33,10 @@ func TestSetDefaults(t *testing.T) {
func TestSetup(t *testing.T) {
if !setupRan {
cfg := config.GetConfig()
cfg.LoadConfig("../../testdata/configtest.json")
err := cfg.LoadConfig("../../testdata/configtest.json", true)
if err != nil {
log.Fatal("Test Failed - LakeBTC load config error", err)
}
lakebtcConfig, err := cfg.GetExchangeConfig("LakeBTC")
if err != nil {
t.Error("Test Failed - LakeBTC Setup() init error")
@@ -41,7 +45,10 @@ func TestSetup(t *testing.T) {
lakebtcConfig.API.Credentials.Key = apiKey
lakebtcConfig.API.Credentials.Secret = apiSecret
lakebtcConfig.Features.Enabled.Websocket = true
l.Setup(lakebtcConfig)
err = l.Setup(lakebtcConfig)
if err != nil {
t.Fatal("Test Failed - LakeBTC setup error", err)
}
l.API.Endpoints.WebsocketURL = lakeBTCWSURL
setupRan = true
}