Add configurable listen port and Makefile
Signed-off-by: Aoi K <koizumi.aoi@chaotic.ninja> git-svn-id: file:///srv/svn/repo/toyohime/trunk@108 922d331f-388e-da47-97a9-ad700dc0b8b9
This commit is contained in:
parent
62cd7abf7a
commit
5c95c8fdd1
10
Makefile
Normal file
10
Makefile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
GO ?= go
|
||||||
|
GOFLAGS ?= -v
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
|
||||||
|
vanityserver:
|
||||||
|
$(GO) build $(GOFLAGS) ./cmd/$@
|
||||||
|
install:
|
||||||
|
install -m0755 vanityserver $(PREFIX)/bin/vanityserver
|
||||||
|
uninstall:
|
||||||
|
rm -f $(PREFIX)/bin/vanityserver
|
@ -38,13 +38,14 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.jonnrb.io/vanity"
|
"git.chaotic.ninja/koizumi.aoi/vanity"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
showIndex = flag.Bool("index", false, "Show a list of repos at /")
|
showIndex = flag.Bool("index", false, "Show a list of repos at /")
|
||||||
noHealthz = flag.Bool("nohealthz", false, "Disable healthcheck endpoint at /healthz")
|
noHealthz = flag.Bool("nohealthz", false, "Disable healthcheck endpoint at /healthz")
|
||||||
watch = flag.Bool("watch", false, "Watch repos file for changes and reload")
|
watch = flag.Bool("watch", false, "Watch repos file for changes and reload")
|
||||||
|
listenPort = flag.String("listen", ":8080", "Port to bind on")
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -179,7 +180,7 @@ func buildServer(h http.Handler) *http.Server {
|
|||||||
WriteTimeout: 5 * time.Second,
|
WriteTimeout: 5 * time.Second,
|
||||||
IdleTimeout: 5 * time.Second,
|
IdleTimeout: 5 * time.Second,
|
||||||
|
|
||||||
Addr: ":8080",
|
Addr: *listenPort,
|
||||||
Handler: h,
|
Handler: h,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
|||||||
module go.jonnrb.io/vanity
|
module git.chaotic.ninja/koizumi.aoi/vanity
|
||||||
|
|
||||||
go 1.14
|
go 1.14
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ Nothing to see here; <a href="{{ . }}">move along</a>.
|
|||||||
// Use default GDDO Redirector.
|
// Use default GDDO Redirector.
|
||||||
if cfg.redir == nil {
|
if cfg.redir == nil {
|
||||||
cfg.redir = func(pkg string) string {
|
cfg.redir = func(pkg string) string {
|
||||||
return "https://godoc.org/" + pkg
|
return "https://godocs.io/" + pkg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user