29 lines
630 B
Go
29 lines
630 B
Go
package rwiki
|
|
|
|
import (
|
|
"vultras.su/core/cli/mtool"
|
|
"vultras.su/core/bond"
|
|
"vultras.su/service/rwiki/server"
|
|
"log"
|
|
)
|
|
|
|
var Tool = mtool.T("rwiki").Func(func(flags *mtool.Flags){
|
|
var (
|
|
addr string
|
|
opts server.ServerOptions
|
|
)
|
|
flags.StringVar(&addr, "a", ":8080", "address string")
|
|
flags.StringVar(&opts.WikiPath, "wiki", "wiki", "path to wiki files")
|
|
flags.StringVar(&opts.WebPath, "web", "web", "path to static web files")
|
|
|
|
flags.Parse()
|
|
srv := bond.Server{
|
|
Addr: addr,
|
|
Handler: bond.Root(server.New(opts)),
|
|
}
|
|
log.Println("Serving at ", addr)
|
|
err := srv.ListenAndServe()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
})
|