summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2019-05-16 14:20:01 +0200
committerRuben Pollan <meskio@sindominio.net>2019-05-16 14:20:01 +0200
commitfc0574604581e6bfd5177f6547a0510d40e00791 (patch)
tree9bbab72cb756cc13dcb7d699deeda537ff9bffec
parent75bb409fa598766bb550fe703654a77cdec9a791 (diff)
[bug] start VPN automatically on first launch
When there was no configuration file the 'conf.StartVPN' was set tu false. Let's set it properly even if there is no config file. - Resolves: #128
-rw-r--r--pkg/systray/config.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/pkg/systray/config.go b/pkg/systray/config.go
index e53dea9..2e97456 100644
--- a/pkg/systray/config.go
+++ b/pkg/systray/config.go
@@ -57,12 +57,11 @@ func ParseConfig() *Config {
f, err := os.Open(configPath)
if err != nil {
conf.save()
- return &conf
+ } else {
+ defer f.Close()
+ dec := json.NewDecoder(f)
+ err = dec.Decode(&conf.file)
}
- defer f.Close()
-
- dec := json.NewDecoder(f)
- err = dec.Decode(&conf.file)
conf.SelectGateway = conf.file.SelectGateway
conf.DisableAustostart = conf.file.DisableAustostart