ctrl/config.go

46 lines
656 B
Go
Raw Normal View History

2024-07-21 12:40:28 +02:00
package main
import (
"log"
"github.com/BurntSushi/toml"
)
type httpFeature struct {
Host string
Port int
}
type sshFeature struct {
SSHKeyPath string
SSHKeyPassphrasePath string
}
type wolTarget struct {
Name string
MAC string
}
type limitsFeature struct {
RemoteCmds []string
WolHosts []wolTarget
}
type tomlConfig struct {
HTTP httpFeature `toml:"http"`
SSH sshFeature `toml:"ssh"`
Limits limitsFeature `toml:"limits"`
}
func readConfig(path string) *tomlConfig {
var conf tomlConfig
_, err := toml.DecodeFile(path, &conf)
if err != nil {
log.Fatal(err)
}
// log.Println(meta.Keys())
return &conf
}