cleaning some stuff up
parent
208bb98577
commit
9b5b6a3d8f
@ -0,0 +1,32 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"orel.li/modularium/internal/index"
|
||||
"orel.li/modularium/internal/ref"
|
||||
)
|
||||
|
||||
func serve(args []string) {
|
||||
path := "./modularium.sock"
|
||||
indexPath := pathArg{path: "./modules-index.json"}
|
||||
|
||||
serveFlags := flag.NewFlagSet("serve", flag.ExitOnError)
|
||||
serveFlags.StringVar(&path, "l", path, "path for a unix domain socket to listen on")
|
||||
serveFlags.Var(&indexPath, "index", "an index config")
|
||||
serveFlags.Parse(args)
|
||||
|
||||
idx, err := index.Load(indexPath.path)
|
||||
if err != nil {
|
||||
shutdown(err)
|
||||
}
|
||||
log_info.Printf("index: %v", idx)
|
||||
|
||||
h := handler{
|
||||
path: ref.New(&path),
|
||||
index: ref.New(&indexPath),
|
||||
}
|
||||
if err := h.run(); err != nil {
|
||||
bail(1, err.Error())
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue