-
-
Notifications
You must be signed in to change notification settings - Fork 274
/
config.go
67 lines (57 loc) · 1.98 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package core
import (
"flag"
"github.com/safing/portbase/config"
"github.com/safing/portbase/log"
)
// Configuration Keys.
var (
// CfgDevModeKey is originally defined in portbase/config.
CfgDevModeKey = config.CfgDevModeKey
CfgNetworkServiceKey = "core/networkService"
defaultNetworkServiceMode bool
CfgUseSystemNotificationsKey = "core/useSystemNotifications"
)
func init() {
flag.BoolVar(&defaultNetworkServiceMode, "network-service", false, "force network service mode")
}
func logFlagOverrides() {
if defaultNetworkServiceMode {
log.Warningf("core: %s config is being forced by the -network-service flag", CfgNetworkServiceKey)
}
}
func registerConfig() error {
err := config.Register(&config.Option{
Name: "Network Service",
Key: CfgNetworkServiceKey,
Description: "Use the Portmaster as a network service, where applicable. You will have to take care of lots of network setup yourself in order to run this properly and securely.",
OptType: config.OptTypeBool,
ExpertiseLevel: config.ExpertiseLevelExpert,
ReleaseLevel: config.ReleaseLevelExperimental,
DefaultValue: defaultNetworkServiceMode,
Annotations: config.Annotations{
config.DisplayOrderAnnotation: 513,
config.CategoryAnnotation: "Network Service",
},
})
if err != nil {
return err
}
err = config.Register(&config.Option{
Name: "Desktop Notifications",
Key: CfgUseSystemNotificationsKey,
Description: "In addition to showing notifications in the Portmaster App, also send them to the Desktop. This requires the Portmaster Notifier to be running.",
OptType: config.OptTypeBool,
ExpertiseLevel: config.ExpertiseLevelUser,
ReleaseLevel: config.ReleaseLevelStable,
DefaultValue: true, // TODO: turn off by default on unsupported systems
Annotations: config.Annotations{
config.DisplayOrderAnnotation: -15,
config.CategoryAnnotation: "User Interface",
},
})
if err != nil {
return err
}
return nil
}