fix: initialize reporting engine in standard binary

Pro license holders running the standard Docker image/binary were
getting "Reporting engine not initialized" errors because the
reporting engine was only wired up in the enterprise build.

Now the core server initializes the reporting engine automatically
when the metrics store is ready, ensuring PDF/CSV report generation
works for all Pro license holders regardless of which binary they use.

The enterprise hooks are still honored if set, allowing the enterprise
build to override with its own implementation if needed.
This commit is contained in:
rcourtman 2026-02-03 16:53:20 +00:00
parent 3ea3f0f827
commit c6aeb9429b

View file

@ -26,6 +26,7 @@ import (
"github.com/rcourtman/pulse-go-rewrite/pkg/audit"
"github.com/rcourtman/pulse-go-rewrite/pkg/auth"
"github.com/rcourtman/pulse-go-rewrite/pkg/metrics"
"github.com/rcourtman/pulse-go-rewrite/pkg/reporting"
"github.com/rs/zerolog/log"
)
@ -171,6 +172,18 @@ func Run(ctx context.Context, version string) error {
}()
}
// Initialize reporting engine if not already set by enterprise hooks
// This ensures Pro license holders get reporting even with the standard binary
if reporting.GetEngine() == nil {
if store := reloadableMonitor.GetMonitor().GetMetricsStore(); store != nil {
engine := reporting.NewReportEngine(reporting.EngineConfig{
MetricsStore: store,
})
reporting.SetEngine(engine)
log.Info().Msg("Advanced Infrastructure Reporting (PDF/CSV) initialized")
}
}
// Set state getter for WebSocket hub (legacy - for default org)
wsHub.SetStateGetter(func() interface{} {
state := reloadableMonitor.GetMonitor().GetState()