예제 #1
0
파일: beard.go 프로젝트: exupero/beard
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
}
예제 #2
0
파일: beard.go 프로젝트: exupero/beard
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)
}