picoclaw/pkg/health/server_ext.go
dj-oyu 67420006b5 refactor: adopt upstream versions for docs, config, and low-diff Go files
Replace 30+ files with upstream's exact versions to eliminate merge
conflicts. Fork-only additions (interfaces, struct fields, methods)
are re-added at non-conflicting positions or in separate _ext.go files.

Files replaced: READMEs, CI configs, docs, Makefile, and ~20 Go source
files with <30 line diffs from upstream.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 09:46:34 +09:00

28 lines
668 B
Go

package health
import (
"crypto/tls"
"fmt"
"net/http"
)
// Mux returns the underlying ServeMux so additional routes can be registered.
func (s *Server) Mux() *http.ServeMux {
return s.server.Handler.(*http.ServeMux)
}
// StartTLS starts the server with TLS using the provided certificate and key files.
func (s *Server) StartTLS(certFile, keyFile string) error {
s.mu.Lock()
s.ready = true
s.mu.Unlock()
cert, err := tls.LoadX509KeyPair(certFile, keyFile)
if err != nil {
return fmt.Errorf("failed to load TLS cert: %w", err)
}
s.server.TLSConfig = &tls.Config{
Certificates: []tls.Certificate{cert},
}
return s.server.ListenAndServeTLS("", "")
}