Files
WatchDog_Linux-systemd/config.go
NanamiAdmin f6005cb324 feat: add initial project structure with logging and watchdog service
Implement basic watchdog service for Linux systemd with:
- Configuration loading
- Logging system with database support
- WebSocket log broadcasting
- TCP server for agent communication
- Project setup with Go modules
2026-04-02 21:56:40 +08:00

30 lines
577 B
Go

package main
import (
"Watchdog_Linux-systemd/postLog"
"encoding/json"
"fmt"
"os"
)
var Config struct {
DebugMode bool `json:"debugMode"`
}
func loadConfig() {
configFile, err := os.Open("config.json")
if err != nil {
postLog.Fatal(fmt.Sprintf("Failed to open config file: %v, err: %v", configFile, err))
}
defer configFile.Close()
decoder := json.NewDecoder(configFile)
if err := decoder.Decode(&Config); err != nil {
postLog.Fatal(fmt.Sprintf("Failed to decode config file: %v, err: %v", configFile, err))
}
if Config.DebugMode {
isDebug = true
}
}