Add stepmon component

This commit is contained in:
2025-05-24 01:15:22 +02:00
parent 3a7bc25dfb
commit e40cfed4f0
7 changed files with 339 additions and 4 deletions

34
config/config.go Normal file
View File

@@ -0,0 +1,34 @@
package config
import (
"os"
"github.com/pelletier/go-toml/v2"
)
type StepMonitor struct {
Enabled bool `toml:"Enabled"`
BaseURL string `toml:"BaseURL"`
RootID string `toml:"RootID"`
}
type Config struct {
ListenAddr string `toml:"ListenAddr"`
StepMonitors []StepMonitor `toml:"StepMonitors"`
}
func FromFile(file string) (*Config, error) {
var config Config
f, err := os.Open(file)
if err != nil {
return nil, err
}
decoder := toml.NewDecoder(f)
if err := decoder.Decode(&config); err != nil {
return nil, err
}
return &config, nil
}