new init() and config()

This commit is contained in:
Jeff Carr 2025-09-11 03:36:47 -05:00
parent c8d67da4cc
commit b984a53aac
2 changed files with 22 additions and 2 deletions

19
config.go Normal file
View File

@ -0,0 +1,19 @@
package main
import (
"go.wit.com/lib/config"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/log"
)
// sent via -ldflags
func configInit() *forgepb.ForgeConfigs {
configs := new(forgepb.ForgeConfigs)
err := config.ConfigLoad(configs, "forge", "forge")
if err != nil {
log.Info("This tool requires your repos be scanned by forge first")
badExit(err)
}
return configs
}

View File

@ -41,8 +41,9 @@ func main() {
state = make(map[*gitpb.Repo]string) state = make(map[*gitpb.Repo]string)
debnames = make(map[*gitpb.Repo]string) debnames = make(map[*gitpb.Repo]string)
// load the ~/.config/forge/ config // read in forge info
me.forge = forgepb.Init() cfg := configInit()
me.forge = forgepb.InitFromConfig(cfg)
me.machine = new(zoopb.Machine) me.machine = new(zoopb.Machine)
if err := me.machine.ConfigLoad(); err != nil { if err := me.machine.ConfigLoad(); err != nil {