From 1477b675ff3d1b72070c06c30bf4384f8c20862a Mon Sep 17 00:00:00 2001 From: Byron Ruth Date: Mon, 26 Dec 2022 08:45:22 -0500 Subject: [PATCH] Add back existing HealthzOptions.JSEnabled field This fixes a backwards incompat change for library usage as well as using the healthz NATS API which depends on the JSON payload. Signed-off-by: Byron Ruth --- server/monitor.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/monitor.go b/server/monitor.go index 5c5a5b7f..427b2581 100644 --- a/server/monitor.go +++ b/server/monitor.go @@ -2631,6 +2631,8 @@ type JSzOptions struct { // HealthzOptions are options passed to Healthz type HealthzOptions struct { + // Deprecated: Use JSEnabledOnly instead + JSEnabled bool `json:"js-enabled,omitempty"` JSEnabledOnly bool `json:"js-enabled-only,omitempty"` JSServerOnly bool `json:"js-server-only,omitempty"` } @@ -2985,7 +2987,8 @@ func (s *Server) HandleHealthz(w http.ResponseWriter, r *http.Request) { } hs := s.healthz(&HealthzOptions{ - JSEnabledOnly: jsEnabledOnly || jsEnabled, + JSEnabled: jsEnabled, + JSEnabledOnly: jsEnabledOnly, JSServerOnly: jsServerOnly, }) if hs.Error != _EMPTY_ { @@ -3031,7 +3034,7 @@ func (s *Server) healthz(opts *HealthzOptions) *HealthStatus { return health } // Only check if JS is enabled, skip meta and asset check. - if opts.JSEnabledOnly { + if opts.JSEnabledOnly || opts.JSEnabled { return health }