fix: 修复写队列 busy 恢复、关闭安全、备份与配置构建问题

This commit is contained in:
Nixevol
2026-09-30 16:21:05 +08:00
parent 4059a1576b
commit 57c2f70678
23 changed files with 825 additions and 101 deletions
+15 -1
View File
@@ -1,6 +1,7 @@
package main
import (
"crypto/tls"
"fmt"
"io"
"net"
@@ -25,8 +26,15 @@ func cmdHealthcheck(_ []string) error {
if err != nil {
return err
}
url := "http://" + addr + "/healthz"
client := &http.Client{Timeout: 3 * time.Second}
scheme := "http"
if healthcheckUseHTTPS(cfg) {
scheme = "https"
client.Transport = &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // 本机 HEALTHCHECK,自签证书可接受
}
}
url := scheme + "://" + addr + "/healthz"
resp, err := client.Get(url)
if err != nil {
return fmt.Errorf("healthcheck %s: %w", url, err)
@@ -39,6 +47,12 @@ func cmdHealthcheck(_ []string) error {
return nil
}
func healthcheckUseHTTPS(cfg config.Config) bool {
cert := strings.TrimSpace(cfg.TLS.CertFile)
key := strings.TrimSpace(cfg.TLS.KeyFile)
return cert != "" && key != "" && !cfg.TLS.AllowPlaintext
}
func resolveHealthAddr(dataDir, listen string) (string, error) {
path := filepath.Join(dataDir, "listen.addr")
if b, err := os.ReadFile(path); err == nil {