Merge dev-2026-03-21 into main #1

Merged
hzhang merged 3 commits from dev-2026-03-21 into main 2026-03-22 14:16:02 +00:00
3 changed files with 9 additions and 2 deletions
Showing only changes of commit ccfa49bc7d - Show all commits

View File

@@ -15,6 +15,7 @@ ENV HF_MONITER_BACKEND_URL=https://monitor.hangman-lab.top \
HF_MONITER_API_KEY= \
HF_MONITER_REPORT_INTERVAL=30 \
HF_MONITER_LOG_LEVEL=info \
HF_MONITER_ROOTFS=/host
HF_MONITER_ROOTFS=/host \
MONITOR_PORT=0
ENTRYPOINT ["/usr/local/bin/harborforge-monitor"]

View File

@@ -4,5 +4,6 @@
"apiKey": "replace-with-server-api-key",
"reportIntervalSec": 30,
"logLevel": "info",
"rootFs": "/host"
"rootFs": "/host",
"monitorPort": 0
}

View File

@@ -14,6 +14,7 @@ type Config struct {
ReportIntervalSec int `json:"reportIntervalSec"`
LogLevel string `json:"logLevel"`
RootFS string `json:"rootFs"`
MonitorPort int `json:"monitorPort"`
}
func Load(path string) (Config, error) {
@@ -43,6 +44,7 @@ func Load(path string) (Config, error) {
cfg.ReportIntervalSec = getenvIntAny([]string{"HF_MONITER_REPORT_INTERVAL", "HF_MONITOR_REPORT_INTERVAL"}, cfg.ReportIntervalSec)
cfg.LogLevel = getenvAny([]string{"HF_MONITER_LOG_LEVEL", "HF_MONITOR_LOG_LEVEL"}, cfg.LogLevel)
cfg.RootFS = getenvAny([]string{"HF_MONITER_ROOTFS", "HF_MONITOR_ROOTFS"}, cfg.RootFS)
cfg.MonitorPort = getenvIntAny([]string{"MONITOR_PORT", "HF_MONITOR_PORT"}, cfg.MonitorPort)
if cfg.BackendURL == "" {
return cfg, fmt.Errorf("backendUrl is required")
@@ -88,6 +90,9 @@ func merge(dst *Config, src Config) {
if src.RootFS != "" {
dst.RootFS = src.RootFS
}
if src.MonitorPort > 0 {
dst.MonitorPort = src.MonitorPort
}
}
func getenvAny(keys []string, fallback string) string {