feat(agent) multi-driver db monitoring, hot-plug config, release pipeline

This commit is contained in:
2026-06-15 17:29:53 +01:00
parent db6ed003f1
commit 40811ed6e8
17 changed files with 949 additions and 34 deletions

45
internal/config/config.go Normal file
View File

@@ -0,0 +1,45 @@
package config
import (
"errors"
"os"
)
const DefaultDBConfigPath = "/etc/bugswatch/databases.json"
type Config struct {
Endpoint string
AgentID string
APIToken string
HostID string
Env string
DBConfigPath string
}
func Load() (Config, error) {
dbConfig := os.Getenv("BUGSWATCH_DB_CONFIG")
if dbConfig == "" {
dbConfig = DefaultDBConfigPath
}
cfg := Config{
Endpoint: os.Getenv("BUGSWATCH_ENDPOINT"),
AgentID: os.Getenv("BUGSWATCH_AGENT_ID"),
APIToken: os.Getenv("BUGSWATCH_API_TOKEN"),
HostID: os.Getenv("BUGSWATCH_HOST_ID"),
Env: os.Getenv("BUGSWATCH_ENVIRONMENT"),
DBConfigPath: dbConfig,
}
if cfg.Endpoint == "" {
return Config{}, errors.New("BUGSWATCH_ENDPOINT not set")
}
if cfg.AgentID == "" {
return Config{}, errors.New("BUGSWATCH_AGENT_ID not set")
}
if cfg.APIToken == "" {
return Config{}, errors.New("BUGSWATCH_API_TOKEN not set")
}
return cfg, nil
}