Example #1
0
File: main.go Project: e8vm/shanhu
func main() {
	flag.Parse()

	c, err := shanhu.LoadConfig(*config)
	ne(err)

	s, err := storage.Make(c)
	ne(err)

	p := fmtutil.NewPrinter(os.Stdout)
	printTree(s.SiteDB, p, "/", *treeHash)
}
Example #2
0
File: main.go Project: e8vm/shanhu
func main() {
	flag.Parse()

	c, err := shanhu.LoadConfig(*config)
	ne(err)

	s, err := storage.Make(c)
	ne(err)

	switch {
	case *command == "":
		runShell(s)
	default:
		j, err := makeJob(s)
		ne(err)
		j.Line = *command
		exec(j)
	}
}
Example #3
0
File: main.go Project: e8vm/shanhu
func main() {
	flag.Parse()
	c, err := shanhu.LoadConfig(*config)
	ne(err)

	var s *shanhu.Storage
	if c.MysqlDB != "" {
		s, err = mysql.Shanhu(c)
		ne(err)
	} else {
		s, err = sqlite.Shanhu(c)
		ne(err)
	}

	h, err := shanhu.NewServer(c, s)
	ne(err)

	http.Handle("/", h)
	log.Printf("server at %s", *addr)
	err = http.ListenAndServe(*addr, nil)
	ne(err)
}