Reuse a single long-poll HTTP client instead of creating one per Events() call (~every 30s). Make TLS skip-verify configurable via syncthing_insecure_tls. Log previously swallowed config errors. Add unit tests for all monitor trackers, config, and state logic. Add CI workflow (vet, golangci-lint, govulncheck, go test -race). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
20 lines
461 B
Go
20 lines
461 B
Go
package config
|
|
|
|
import "path/filepath"
|
|
|
|
// configDirOverride allows tests to redirect config I/O to a temp directory.
|
|
var configDirOverride string
|
|
|
|
// configDir returns the override dir if set, otherwise the platform default.
|
|
func configDir() string {
|
|
if configDirOverride != "" {
|
|
return configDirOverride
|
|
}
|
|
return ConfigDir()
|
|
}
|
|
|
|
// ConfigPath returns the path to config.json.
|
|
func ConfigPath() string {
|
|
return filepath.Join(configDir(), "config.json")
|
|
}
|