1
0
forked from x/icebergs
icebergs/misc/git/server.go
2021-02-23 18:46:33 +08:00

32 lines
883 B
Go

package git
import (
"github.com/AaronO/go-git-http"
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/web"
kit "github.com/shylinux/toolkits"
)
const SERVE = "serve"
func init() {
Index.Merge(&ice.Context{
Configs: map[string]*ice.Config{
SERVE: {Name: SERVE, Help: "服务", Value: kit.Data(
kit.MDB_SHORT, kit.MDB_NAME, kit.MDB_FIELD, "time,name,branch,commit",
"owner", "https://github.com/shylinux",
kit.MDB_PATH, ".ish/pluged",
)},
},
Commands: map[string]*ice.Command{
web.WEB_LOGIN: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Render(ice.RENDER_VOID)
}},
"/github.com/": {Name: "github.com", Help: "github.com", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
githttp.New(kit.Path(m.Conf(SERVE, kit.META_PATH))).ServeHTTP(m.W, m.R)
}},
},
})
}