Set up nested directory structure for interfaces, configuration, structs, libraries

This commit is contained in:
Michael Hohn
2024-05-10 13:28:47 -07:00
committed by =Michael Hohn
parent 12595077c7
commit d38b561309
2 changed files with 34 additions and 27 deletions

33
config/mcc/system.go Normal file
View File

@@ -0,0 +1,33 @@
package mcc
import (
"log/slog"
"os"
"github.com/BurntSushi/toml"
)
type System struct {
commander Commander
logger Logger
queue Queue
storage Storage
runner Runner
}
func LoadConfig(fname string) *System {
if _, err := os.Stat(fname); err != nil {
slog.Error("Configuration file %s not found", fname)
os.Exit(1)
}
var config System
_, err := toml.DecodeFile(fname, &config)
if err != nil {
slog.Error("", err)
os.Exit(1)
}
return &config
}