feat: init pc-monitor project

- Client: Go-based Windows hardware monitoring (CPU, GPU, memory, disk, network, power)
- Server: Go + Gin + SQLite backend with REST API
- Frontend: Vue 3 + Element Plus dashboard
- Docker deployment support
- Windows service installation script
This commit is contained in:
672
2026-05-17 01:29:44 +08:00
commit 0e8c9f7bff
49 changed files with 3291 additions and 0 deletions

51
server/config/config.go Normal file
View File

@@ -0,0 +1,51 @@
package config
import (
"os"
"time"
"gopkg.in/yaml.v3"
)
type Config struct {
Server ServerConfig `yaml:"server"`
Database DatabaseConfig `yaml:"database"`
Auth AuthConfig `yaml:"auth"`
}
type ServerConfig struct {
Addr string `yaml:"addr"`
}
type DatabaseConfig struct {
Path string `yaml:"path"`
RetentionDays int `yaml:"retention_days"`
CleanupInterval time.Duration `yaml:"cleanup_interval"`
}
type AuthConfig struct {
AdminPassword string `yaml:"admin_password"`
}
func Load() *Config {
cfg := &Config{
Server: ServerConfig{
Addr: ":8080",
},
Database: DatabaseConfig{
Path: "./data/monitor.db",
RetentionDays: 30,
CleanupInterval: 24 * time.Hour,
},
Auth: AuthConfig{
AdminPassword: "admin123",
},
}
data, err := os.ReadFile("config.yaml")
if err == nil {
yaml.Unmarshal(data, cfg)
}
return cfg
}