summaryrefslogtreecommitdiff
path: root/pkg/systray/run.go
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2019-02-04 23:23:16 +0100
committerRuben Pollan <meskio@sindominio.net>2019-02-04 23:23:16 +0100
commitb9ef49b51c6e2570ef3aae824ab44374997b6b25 (patch)
tree5fcfcc4931d35b72b1853dff005f0eaca25d00d4 /pkg/systray/run.go
parent51a4d191669aaf5e23ec4e1f61aab71419603003 (diff)
[feat] add -disable-autostart flag and config
Make possible to disable the autostart configuration for the next run. I can be done by configuring "DisableAustostart" to true in the systra.json or by passing the '-disable-autostart' flag to the binary. To make that possible I have rework how the Config struct work separating the file configuration with the runtime configuration. - Resolves: #100
Diffstat (limited to 'pkg/systray/run.go')
-rw-r--r--pkg/systray/run.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/systray/run.go b/pkg/systray/run.go
index 2a513d8..2878928 100644
--- a/pkg/systray/run.go
+++ b/pkg/systray/run.go
@@ -51,7 +51,12 @@ func initialize(conf *Config, bt *bmTray) {
go checkAndStartBitmask(b, notify, conf)
go listenSignals(b)
- as := bitmask.NewAutostart(config.ApplicationName, getIconPath())
+ var as bitmask.Autostart
+ if conf.DisableAustostart {
+ as = &bitmask.DummyAutostart{}
+ } else {
+ as = bitmask.NewAutostart(config.ApplicationName, getIconPath())
+ }
err = as.Enable()
if err != nil {
log.Printf("Error enabling autostart: %v", err)
@@ -93,7 +98,7 @@ func checkAndInstallHelpers(b bitmask.Bitmask, notify *notificator) error {
}
func maybeStartVPN(b bitmask.Bitmask, conf *Config) error {
- if conf.UserStoppedVPN {
+ if conf.wasUserStopped() {
return nil
}