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.
()
| 131 | // or from the path specified by configFile. |
| 132 | // This configuration will be loaded again by uiClient(), in order to monitor it for changes. |
| 133 | func 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 | |
| 151 | func overwriteLogging() bool { |
| 152 | return debug || warning || important || errorlog || logFile != "" || logMicro |