From bebefcd30961eff674681eddd45166b5a4a94c76 Mon Sep 17 00:00:00 2001 From: ersonp Date: Thu, 12 May 2022 16:32:22 +0530 Subject: [PATCH 1/3] Fix Falling back on hardcoded servers This commit fixes the fallback logic by falling back on all config urls and not just of prod. --- pkg/visor/visorconfig/services.go | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/pkg/visor/visorconfig/services.go b/pkg/visor/visorconfig/services.go index 7554dfe46d..69d7337a89 100644 --- a/pkg/visor/visorconfig/services.go +++ b/pkg/visor/visorconfig/services.go @@ -10,16 +10,10 @@ import ( "github.com/skycoin/skycoin/src/util/logging" "github.com/skycoin/skywire-utilities/pkg/cipher" - utilenv "github.com/skycoin/skywire-utilities/pkg/skyenv" ) -var ( - services *Services - svcconf = strings.ReplaceAll(utilenv.ServiceConfAddr, "http://", "") -) - -//Fetch fetches the service URLs & ip:ports from the config service endpoint -func Fetch(mLog *logging.MasterLogger, serviceConfURL string, stdout bool) *Services { +// Fetch fetches the service URLs & ip:ports from the config service endpoint +func Fetch(mLog *logging.MasterLogger, serviceConfURL string, stdout bool) (services *Services) { urlstr := []string{"http://", serviceConfURL} serviceConf := strings.Join(urlstr, "") @@ -34,15 +28,10 @@ func Fetch(mLog *logging.MasterLogger, serviceConfURL string, stdout bool) *Serv //check for errors in the response res, err := client.Do(req) if err != nil { - if serviceConfURL != svcconf { - //if serviceConfURL was changed this error should be fatal - mLog.WithError(err).Fatal("Failed to fetch servers\n") - } else { //otherwise just error and continue - //silence errors for stdout - if !stdout { - mLog.WithError(err).Error("Failed to fetch servers\n") - mLog.Warn("Falling back on hardcoded servers") - } + //silence errors for stdout + if !stdout { + mLog.WithError(err).Error("Failed to fetch servers\n") + mLog.Warn("Falling back on hardcoded servers") } } else { // nil error from client.Do(req) From 4e5616cb685779802f79c80c76cfa64571262762 Mon Sep 17 00:00:00 2001 From: ersonp Date: Thu, 12 May 2022 16:33:55 +0530 Subject: [PATCH 2/3] Fix var output This commit fixes the case where the var output is printed empty when default value of the output is used. --- cmd/skywire-cli/commands/config/gen.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/skywire-cli/commands/config/gen.go b/cmd/skywire-cli/commands/config/gen.go index 48edf7335f..11215cf533 100644 --- a/cmd/skywire-cli/commands/config/gen.go +++ b/cmd/skywire-cli/commands/config/gen.go @@ -136,6 +136,7 @@ var genConfigCmd = &cobra.Command{ if output == "" { outunset = true confPath = skyenv.ConfigName + output = confPath } else { confPath = output } From 7248ee18e31769262b1d27172ab69682c570e321 Mon Sep 17 00:00:00 2001 From: ersonp Date: Fri, 13 May 2022 11:32:12 +0530 Subject: [PATCH 3/3] Minor systray fix --- internal/gui/gui.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/gui/gui.go b/internal/gui/gui.go index 2ba0ed56f6..00bd03a262 100644 --- a/internal/gui/gui.go +++ b/internal/gui/gui.go @@ -232,9 +232,11 @@ func serversBtn(conf *visorconfig.V1, servers []*systray.MenuItem, rpcClient vis btnChannel := make(chan int) for index, server := range servers { go func(chn chan int, server *systray.MenuItem, index int) { - select { - case <-server.ClickedCh: - chn <- index + for { + select { + case <-server.ClickedCh: + chn <- index + } } }(btnChannel, server, index) }