[Feature] Introduce Module interface and registry in main.go #8

Open
opened 2026-07-13 04:25:48 +00:00 by ilvoen · 0 comments
Owner

Motivation

Refactor main.go from a linear setup into a module registry. Define a shared Module interface:

type Module interface {
	Name() string
	Enabled(cfg *Config) bool
	RegisterRoutes(r *mux.Router, cfg *Config)
	Start(ctx context.Context, cfg *Config) error
	Stop(ctx context.Context) error
}

main.go should only: build the module list, register routes for enabled modules, start their background goroutines, and call Stop on each during graceful shutdown. No feature-specific logic remains in main.go itself.

This is the prerequisite for all other module work below.

Proposal

No response

Alternatives Considered

No response

### Motivation Refactor `main.go` from a linear setup into a module registry. Define a shared `Module` interface: ```go type Module interface { Name() string Enabled(cfg *Config) bool RegisterRoutes(r *mux.Router, cfg *Config) Start(ctx context.Context, cfg *Config) error Stop(ctx context.Context) error } ``` `main.go` should only: build the module list, register routes for enabled modules, start their background goroutines, and call `Stop` on each during graceful shutdown. No feature-specific logic remains in `main.go` itself. This is the prerequisite for all other module work below. ### Proposal _No response_ ### Alternatives Considered _No response_
ilvoen added the enhancement label 2026-07-13 04:25:48 +00:00
ilvoen added this to the Varde Backlog v0.1.0 project 2026-07-13 04:25:48 +00:00
ilvoen moved this to To Do in Varde Backlog v0.1.0 on 2026-07-13 04:25:53 +00:00
ilvoen added this to the v0.1.0 milestone 2026-07-13 04:26:21 +00:00
ilvoen moved this to In Progress in Varde Backlog v0.1.0 on 2026-07-14 13:02:06 +00:00
ilvoen moved this to Testing in Varde Backlog v0.1.0 on 2026-07-14 13:48:47 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ilvoen/varde#8