style: Add macros to enable/disable client building features

This commit is contained in:
yuanyuanxiang
2026-06-05 00:00:03 +02:00
parent fc0be64880
commit ec7cfa1d63
32 changed files with 236 additions and 54 deletions

View File

@@ -752,6 +752,7 @@ func main() {
logCfg.Compress = true
log := logger.New(logCfg)
log.Info("====== Copyright (c) 2026 simpleremoter.com. All rights resvered. ======")
// Track env vars where we fell back to a built-in default. Printed once
// at the end of startup so the operator sees what's in effect — vars the
@@ -961,33 +962,30 @@ func main() {
}()
}
fmt.Printf("Server started on port(s): %v\n", ports)
log.Info("Server started on port(s): %v", ports)
if *httpPort != 0 {
fmt.Printf("Web UI on http://localhost:%d/\n", *httpPort)
log.Info("Web UI on http://localhost:%d/", *httpPort)
if usingDefaultWebPass {
fmt.Printf(" Default login: admin / %s (set YAMA_WEB_ADMIN_PASS to override)\n",
defaultWebAdminPass)
log.Info("Default login: admin / %s (set YAMA_WEB_ADMIN_PASS to override)", defaultWebAdminPass)
}
}
if licenseHTTP != nil {
fmt.Printf("License Server on http://%s/license/{sign,heartbeat}\n", licAddr)
log.Info("License Server on http://%s/license/{sign,heartbeat}", licAddr)
}
if len(defaultsUsed) > 0 {
fmt.Println()
fmt.Println("[!] Using built-in defaults (set the env var to override):")
for _, d := range defaultsUsed {
fmt.Printf(" %s = %s\n", d.name, d.value)
log.Info("[!] Using built-in defaults (set the env var to override): %s = %s", d.name, d.value)
}
}
fmt.Println("Logs are written to: logs/server.log")
fmt.Println("Press Ctrl+C to stop...")
log.Info("Logs are written to: logs/server.log")
log.Info("Press Ctrl+C to stop...")
// Wait for interrupt signal
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
<-sigChan
fmt.Println("\nShutting down...")
log.Info("\nShutting down...")
// Order matters: drain License Server HTTP first so no handleSign is
// mid-flight; THEN close the signer (which may release HTTP keepalives
// in RemoteSigner mode, or be a no-op for LocalSigner/NoOp).
@@ -1003,5 +1001,5 @@ func main() {
for _, srv := range servers {
srv.Stop()
}
fmt.Println("Server stopped")
log.Info("Server stopped")
}