From f91114578c73e0ce4e417ae1344a64eed31e08ea Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Wed, 1 Dec 2021 21:55:28 +0100 Subject: [feat] disable autostart we've agreed that the autostart behaviour can be unexpected; we'll expose the ability under preferences (it can be controlled via cli right now). --- pkg/backend/init.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'pkg/backend') diff --git a/pkg/backend/init.go b/pkg/backend/init.go index fae5ff1..b007c61 100644 --- a/pkg/backend/init.go +++ b/pkg/backend/init.go @@ -72,6 +72,9 @@ func initializeBitmask(errCh chan string, opts *InitOpts) { errCh <- err.Error() return } + // right now we just get autostart from an init flag, + // but we want to be able to persist that option from the preferences + // pane ctx.autostart = initializeAutostart(ctx.cfg) helpers, privilege, err := b.VPNCheck() @@ -119,11 +122,11 @@ func initializeAutostart(conf *config.Config) bitmask.Autostart { if conf.SkipLaunch || conf.DisableAutostart { autostart.Disable() autostart = &bitmask.DummyAutostart{} - } - - err := autostart.Enable() - if err != nil { - log.Printf("Error enabling autostart: %v", err) + } else { + err := autostart.Enable() + if err != nil { + log.Printf("Error enabling autostart: %v", err) + } } return autostart } -- cgit v1.2.3