MCPcopy
hub / github.com/evilsocket/opensnitch / loadDiskConfiguration

Function loadDiskConfiguration

daemon/main.go:133–149  ·  view source on GitHub ↗

Load configuration file from disk, by default from /etc/opensnitchd/default-config.json, or from the path specified by configFile. This configuration will be loaded again by uiClient(), in order to monitor it for changes.

()

Source from the content-addressed store, hash-verified

131// or from the path specified by configFile.
132// This configuration will be loaded again by uiClient(), in order to monitor it for changes.
133func loadDiskConfiguration() (*config.Config, error) {
134 if configFile == "" {
135 return nil, fmt.Errorf("Configuration file cannot be empty")
136 }
137
138 raw, err := config.Load(configFile)
139 if err != nil || len(raw) == 0 {
140 return nil, fmt.Errorf("Error loading configuration %s: %s", configFile, err)
141 }
142 clientConfig, err := config.Parse(raw)
143 if err != nil {
144 return nil, fmt.Errorf("Error parsing configuration %s: %s", configFile, err)
145 }
146
147 log.Info("Loading configuration file %s ...", configFile)
148 return &clientConfig, nil
149}
150
151func overwriteLogging() bool {
152 return debug || warning || important || errorlog || logFile != "" || logMicro

Callers 1

mainFunction · 0.85

Calls 1

LoadMethod · 0.45

Tested by

no test coverage detected