Shortens notification time

Separates bot configuration to its own method to allow for repeat use. Also main.go should be small
Now reloads bot configuration on the save post. Active changes!
This commit is contained in:
Scott
2016-08-12 22:33:44 +10:00
parent 544f94553a
commit dc3de32a2c
3 changed files with 22 additions and 1 deletions

View File

@@ -43,6 +43,7 @@ func SaveAllSettings(w http.ResponseWriter, r *http.Request) {
log.Println("Fatal error checking config values. Error:", err)
panic(err)
}
setupBotExchanges()
//Return response status
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)

20
main.go
View File

@@ -40,6 +40,24 @@ type Bot struct {
var bot Bot
func setupBotExchanges() {
for _, exch := range bot.config.Exchanges {
for i := 0; i < len(bot.exchanges); i++ {
if bot.exchanges[i] != nil {
if bot.exchanges[i].GetName() == exch.Name {
bot.exchanges[i].Setup(exch)
if bot.exchanges[i].IsEnabled() {
log.Printf("%s: Exchange support: %s (Authenticated API support: %s - Verbose mode: %s).\n", exch.Name, IsEnabled(exch.Enabled), IsEnabled(exch.AuthenticatedAPISupport), IsEnabled(exch.Verbose))
bot.exchanges[i].Start()
} else {
log.Printf("%s: Exchange support: %s\n", exch.Name, IsEnabled(exch.Enabled))
}
}
}
}
}
}
func main() {
HandleInterrupt()
log.Println("Loading config file config.json..")
@@ -103,6 +121,8 @@ func main() {
}
}
setupBotExchanges()
err = RetrieveConfigCurrencyPairs(bot.config)
if err != nil {

View File

@@ -11,7 +11,7 @@ angular.module('myApp', [
]).
config(['$locationProvider', '$routeProvider' ,'NotificationProvider', function($locationProvider, $routeProvider, NotificationProvider) {
NotificationProvider.setOptions({
delay: 10000,
delay: 5000,
startTop: 60,
startRight: 10,
verticalSpacing: 10,