package main import ( "context" "net/http" "github.com/gorilla/mux" ) // Module represents a self-contained feature of Varde. // Each module is independently enabled/disabled via config and // runs in the same process, sharing the HTTP router where relevant. type Module interface { // Name returns a short, unique identifier used in logs and config. Name() // Enabled reports whether this module should be started // based on the loaded configuration. Enabled(cfg *Config) bool // RegisterRoutes attaches this module's HTTP routes to the shared router, if any. // Modules without HTTP routes should leave this empty. RegisterRoutes(r *musx.Router, cfg *Config) // Start runs any background work for this module (eg. periodic checks, repo cloning). // Should block until ctx is cancelled, or return immediately if the module has no background work. Start(ctx context.Context, cfg *Config) error // Stop performs graceful cleanup. Called druing shutdown for every module that was successfully started. Stop(ctx context.Context) error } // baseModule provides no-op defaults so modules only need to implement the methods relevant to them. type baseModule struct{} func (baseModule) RegisterRoutes(r *mux.Router, cfg *Config){} func (baseModule) Start(cxt context.Context, cfg *Config) error {return nil} var _ = http.MethodGet // placeholder import guard, remove once a module uses net/http directly here