/
config.go
58 lines (49 loc) · 1.64 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
package core
import (
"flag"
"github.com/safing/portbase/config"
"github.com/safing/portbase/log"
)
// Configuration Keys
var (
CfgDevModeKey = "core/devMode"
defaultDevMode bool
CfgUseSystemNotificationsKey = "core/useSystemNotifications"
)
func init() {
flag.BoolVar(&defaultDevMode, "devmode", false, "force development mode")
}
func logFlagOverrides() {
if defaultDevMode {
log.Warning("core: core/devMode default config is being forced by -devmode flag")
}
}
func registerConfig() error {
err := config.Register(&config.Option{
Name: "Development Mode",
Key: CfgDevModeKey,
Description: "In Development Mode security restrictions are lifted/softened to enable easier access to Portmaster for debugging and testing purposes.",
Order: 127,
OptType: config.OptTypeBool,
ExpertiseLevel: config.ExpertiseLevelDeveloper,
ReleaseLevel: config.ReleaseLevelStable,
DefaultValue: defaultDevMode,
})
if err != nil {
return err
}
err = config.Register(&config.Option{
Name: "Use System Notifications",
Key: CfgUseSystemNotificationsKey,
Description: "Send notifications to your operating system's notification system. When this setting is turned off, notifications will only be visible in the Portmaster App. This affects both alerts from the Portmaster and questions from the Privacy Filter.",
Order: 32,
OptType: config.OptTypeBool,
ExpertiseLevel: config.ExpertiseLevelUser,
ReleaseLevel: config.ReleaseLevelStable,
DefaultValue: true, // TODO: turn off by default on unsupported systems
})
if err != nil {
return err
}
return nil
}