forked from x/icebergs
add git server
This commit is contained in:
parent
3c9285a595
commit
019b7426da
2
go.sum
2
go.sum
@ -13,6 +13,8 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
|
||||
github.com/nareix/joy4 v0.0.0-20200507095837-05a4ffbb5369/go.mod h1:aFJ1ZwLjvHN4yEzE5Bkz8rD8/d8Vlj3UIuvz2yfET7I=
|
||||
github.com/shylinux/toolkits v0.1.9 h1:gfQnXSBBuCtUueNF5eL0kZAjJS8pzODrjxIL0WynqsQ=
|
||||
github.com/shylinux/toolkits v0.1.9/go.mod h1:Y68Ot6xOmo1bun67YvqC3chDGeU2gDxtsUnvVDGJm4g=
|
||||
github.com/shylinux/toolkits v0.2.0 h1:ZMJGFqqgZBXxu2jUw2Zqu8Vx8KhEgWcMBnlH3cR+MPQ=
|
||||
github.com/shylinux/toolkits v0.2.0/go.mod h1:Y68Ot6xOmo1bun67YvqC3chDGeU2gDxtsUnvVDGJm4g=
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
|
||||
github.com/tuotoo/qrcode v0.0.0-20190222102259-ac9c44189bf2/go.mod h1:lPnW9HVS0vJdeYyQtOvIvlXgZPNhUAhwz+z5r8AJk0Y=
|
||||
|
38
misc/git/server.go
Normal file
38
misc/git/server.go
Normal file
@ -0,0 +1,38 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
ice "github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/icebergs/base/cli"
|
||||
"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",
|
||||
)},
|
||||
},
|
||||
Commands: map[string]*ice.Command{
|
||||
web.LOGIN: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Option(ice.RENDER_OUTPUT, ice.RENDER_RESULT)
|
||||
}},
|
||||
"/repos/": {Name: "repos", Help: "repos", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Option(cli.CMD_ENV,
|
||||
"GIT_HTTP_EXPORT_ALL", "true",
|
||||
"GIT_PROJECT_ROOT", kit.Path("./"),
|
||||
"REQUEST_METHOD", m.Option(ice.MSG_METHOD),
|
||||
"QUERY_STRING", m.R.URL.RawQuery,
|
||||
"PATH", os.Getenv("PATH"),
|
||||
)
|
||||
m.Cmdy(cli.SYSTEM, "/usr/lib/git-core/git-http-backend")
|
||||
}},
|
||||
},
|
||||
})
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user