mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 07:26:45 +00:00
Database interface & auditing feature (#332)
* added audit manager * Basic database DOA setup * Added base config file * added sqlite support and creation of schema * added basic tests and config entry * corrected issues of database is disabled * fixed path for test * WIP * Added tests fixed config checking * reverted files back to upstream * reverted go.mod files * no more test test test * removed local testing details for psql * hello * added comments * increased ping to 30 seconds * renamed database table and added additional condition around test * removed database test details * goimport ran on all files * WIP * first attempt at migration * fixes for migration system * Migration system logger interface implemented * fixes to print functions * added write pooling pass * gofmt :D * formatted imports correctly * removed old code * added creation of migration * gofmt * :D Hello * ❌ 🏎️ * maybe one day i will remember to revert go mod files * checked err return condition correctly * first changes for PR feedback * code clean up * protect Connected with RWmutex & event with mutex * : D * we can just pretend like it never happened * MOved migrations back to source directory and added README * readme formatting update * Addd command line override for datadir * use correct var when creating a migration and confirm folder is created * Check if database version is newer than latest migration and also you know make migrations work..... * uses filepath instead of manual path to use correct path seperator * Add connection message and lower timeout * Added support for sslmode for psql * no longer force Close of database instead allow driver to maage * Added closer func to test output * sslmode added to example config
This commit is contained in:
@@ -30,6 +30,7 @@ type Engine struct {
|
||||
ExchangeCurrencyPairManager *ExchangeCurrencyPairSyncer
|
||||
NTPManager ntpManager
|
||||
ConnectionManager connectionManager
|
||||
DatabaseManager databaseManager
|
||||
OrderManager orderManager
|
||||
PortfolioManager portfolioManager
|
||||
CommsManager commsManager
|
||||
@@ -110,6 +111,7 @@ func ValidateSettings(b *Engine, s *Settings) {
|
||||
b.Settings.EnableAllPairs = s.EnableAllPairs
|
||||
b.Settings.EnablePortfolioManager = s.EnablePortfolioManager
|
||||
b.Settings.EnableCoinmarketcapAnalysis = s.EnableCoinmarketcapAnalysis
|
||||
b.Settings.EnableDatabaseManager = s.EnableDatabaseManager
|
||||
|
||||
// TO-DO: FIXME
|
||||
if flag.Lookup("grpc") != nil {
|
||||
@@ -259,6 +261,12 @@ func (e *Engine) Start() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if e.Settings.EnableDatabaseManager {
|
||||
if err := e.DatabaseManager.Start(); err != nil {
|
||||
log.Errorf(log.Global, "Database manager unable to start: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Sets up internet connectivity monitor
|
||||
if e.Settings.EnableConnectivityMonitor {
|
||||
if err := e.ConnectionManager.Start(); err != nil {
|
||||
@@ -417,6 +425,12 @@ func (e *Engine) Stop() {
|
||||
}
|
||||
}
|
||||
|
||||
if e.DatabaseManager.Started() {
|
||||
if err := e.DatabaseManager.Stop(); err != nil {
|
||||
log.Errorf(log.Global, "Database manager unable to stop. Error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if !e.Settings.EnableDryRun {
|
||||
err := e.Config.SaveConfig(e.Settings.ConfigFile)
|
||||
if err != nil {
|
||||
@@ -425,6 +439,7 @@ func (e *Engine) Stop() {
|
||||
log.Debugln(log.Global, "Config file saved successfully.")
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for services to gracefully shutdown
|
||||
e.ServicesWG.Wait()
|
||||
log.Debugln(log.Global, "Exiting.")
|
||||
|
||||
Reference in New Issue
Block a user