hm i dunno about that index concept

master v0.0.0-pre1
Jordan Orelli 3 years ago
parent 9d454a752e
commit 042ccd2d73

2
.gitignore vendored

@ -1 +1 @@
modularium mir

@ -4,4 +4,8 @@ go 1.18
require golang.org/x/mod v0.5.1 require golang.org/x/mod v0.5.1
require golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 // indirect require (
github.com/jordanorelli/lexnum v0.0.0-20141216151731-460eeb125754 // indirect
github.com/jordanorelli/serve v0.0.0-20190310214448-81022000f440 // indirect
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 // indirect
)

@ -1,3 +1,9 @@
github.com/jordanorelli/lexnum v0.0.0-20141216151731-460eeb125754 h1:ovgRFhVUYZWz6KnWPrnV7HBxrK0ErOeyXtlVvh0Rr5k=
github.com/jordanorelli/lexnum v0.0.0-20141216151731-460eeb125754/go.mod h1:f1WdQhB98V35bULPsZUMFP9U1XWhpaHrO6myMijgMhU=
github.com/jordanorelli/serve v0.0.0-20190310214448-81022000f440 h1:of3Mn87FnYXxbHQII4Q1IE2en/r903YPKAy7HgMuo68=
github.com/jordanorelli/serve v0.0.0-20190310214448-81022000f440/go.mod h1:AlXw87dXhL0dJjfMQuyQ+7L/rI555OGfF1ctdwVXRzg=
github.com/jordanorelli/tea v0.0.5 h1:fYI1Ag4Ec0Q9KqtjykQQO1dDNJsBFLBhAi04gOSUjOU=
github.com/jordanorelli/tea v0.0.5/go.mod h1:mnnRKfuTTk8d+3rcOC6TIiBOLVG8RQitOtFtCfQo8Bw=
golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e h1:aZzprAO9/8oim3qStq3wc1Xuxx4QmAGriC4VU4ojemQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e h1:aZzprAO9/8oim3qStq3wc1Xuxx4QmAGriC4VU4ojemQ=

@ -3,28 +3,20 @@ package main
import ( import (
"flag" "flag"
"orel.li/mir/internal/index"
"orel.li/mir/internal/ref" "orel.li/mir/internal/ref"
) )
func serve(args []string) { func serve(args []string) {
path := "./mir.sock" path := "./mir.sock"
indexPath := pathArg{path: "./modules-index.json"} rootDir := "/srv/mir"
serveFlags := flag.NewFlagSet("serve", flag.ExitOnError) serveFlags := flag.NewFlagSet("serve", flag.ExitOnError)
serveFlags.StringVar(&path, "l", path, "path for a unix domain socket to listen on") serveFlags.StringVar(&path, "l", path, "path for a unix domain socket to listen on")
serveFlags.Var(&indexPath, "index", "an index config") serveFlags.StringVar(&rootDir, "root", rootDir, "root directory for module storage")
serveFlags.Parse(args) serveFlags.Parse(args)
idx, err := index.Load(indexPath.path)
if err != nil {
shutdown(err)
}
log_info.Printf("index: %v", idx)
h := handler{ h := handler{
path: ref.New(&path), path: ref.New(&path),
index: ref.New(&indexPath),
} }
if err := h.run(); err != nil { if err := h.run(); err != nil {
bail(1, err.Error()) bail(1, err.Error())

Loading…
Cancel
Save