INNER CODE UNIT · Go

IsConfigDifferent

andrearaponi/dito · config/config.go:288

func IsConfigDifferent(config1, config2 *ProxyConfig) bool {
	return !reflect.DeepEqual(config1, config2)
}

// WatchConfig watches the configuration file for changes and invokes a callback when changes are detected.
// It uses a polling mechanism to check for file modifications.
//
// Parameters:
// - configFile: The path to the configuration file.
// - onChange: A callback function to invoke when the configuration changes.
// - logger: A logger to log messages.
func WatchConfig(configFile string, onChange func(*ProxyConfig), logger *slog.Logger) {
	var lastModified time.Time
	isFirstCheck := true

	ticker := time.NewTicker(2 * time.Second)
	defer ticker.Stop()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…