Beispiel #1
0
func loadCommand(id string) *cmd.Cmd {
	db := connect()
	var conf *config.Config
	err := db.Query(id, nil, &conf)
	logError(err)
	command := cmd.Command(*conf)
	command.Name = id
	return &command
}
Beispiel #2
0
func main() {
	chCmds := make(chan *cmd.Cmd)
	addr, isFound := syscall.Getenv("BEARD_ADDR")
	if !isFound {
		addr = "localhost:8000"
	}
	go startServer(addr, chCmds)

	db := connect()
	var results ViewResults
	err := db.Query("_design/configs/_view/all", nil, &results)
	logError(err)
	for _, row := range results.Rows {
		conf := row.Value
		conf.Name = row.Id
		command := cmd.Command(*conf)
		command.Start()
		go command.KeepAlive()
		chCmds <- &command
	}

	<-make(chan bool)
}