Skip to content

Commit 365eae1

Browse files
authored
fix(caddy): check if http app fails to provision due to not configured or invalid configuration (#1774)
1 parent 2a41fc1 commit 365eae1

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

caddy/app.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ func (f *FrankenPHPApp) Provision(ctx caddy.Context) error {
6262
}
6363
} else {
6464
// if the http module is not configured (this should never happen) then collect the metrics by default
65-
f.metrics = frankenphp.NewPrometheusMetrics(ctx.GetMetricsRegistry())
65+
if errors.Is(err, caddy.ErrNotConfigured) {
66+
f.metrics = frankenphp.NewPrometheusMetrics(ctx.GetMetricsRegistry())
67+
} else {
68+
// the http module failed to provision due to invalid configuration
69+
return fmt.Errorf("failed to provision caddy http: %w", err)
70+
}
6671
}
6772

6873
return nil

0 commit comments

Comments
 (0)