fix broken startup on disabled servers

This commit is contained in:
2025-03-30 11:27:41 -04:00
parent 5c26accc34
commit 4f0c5fe665
3 changed files with 33 additions and 9 deletions

View File

@ -3,12 +3,26 @@ package app
import (
"context"
"github.com/rs/zerolog"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/trace"
optshttp "gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts"
)
func (a *App) runHTTP(ctx context.Context) {
if a.HTTP == nil {
a.HTTP = &optshttp.AppHTTP{
HTTPDone: make(chan any),
}
}
if !a.cfg.HTTPEnabled() {
zerolog.Ctx(ctx).Info().Msg("skipping disabled HTTP Server")
return
}
span := trace.SpanFromContext(ctx)
if err := a.initHTTP(ctx); err != nil {
span.RecordError(err)