diff options
| author | Shulhan <m.shulhan@gmail.com> | 2026-02-11 22:58:06 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2026-04-09 22:18:08 +0700 |
| commit | 3976d893c3015e0c56c47f88acd880646c6fec58 (patch) | |
| tree | 728f419f650db6b936bee903afabe0479c6ae30a | |
| parent | e8fbdf75658c2bb88bc9e3bbd8b23c30709d0502 (diff) | |
| download | go-x-proposal-main.tar.xz | |
The www-go-proposal now is served under "/proposal" so no need to
reroute them in proxy.
The "-shutdown-idle" option allow to set the duration when server will
automatically shutting down when no new connections accepted after
specific duration.
| -rw-r--r-- | cmd/www-go-proposal/main.go | 19 | ||||
| -rw-r--r-- | go.mod | 4 | ||||
| -rw-r--r-- | go.sum | 8 |
3 files changed, 22 insertions, 9 deletions
diff --git a/cmd/www-go-proposal/main.go b/cmd/www-go-proposal/main.go index 2581186..c31da25 100644 --- a/cmd/www-go-proposal/main.go +++ b/cmd/www-go-proposal/main.go @@ -8,6 +8,7 @@ import ( "flag" "log" "strings" + "time" "git.sr.ht/~shulhan/ciigo" "git.sr.ht/~shulhan/pakakeh.go/lib/http" @@ -35,19 +36,31 @@ func main() { } var serveOpts = ciigo.ServeOptions{ ServerOptions: http.ServerOptions{ - Memfs: memFS, + BasePath: `/proposal`, + Memfs: memFS, }, } + var shutdownIdleDuration string flag.BoolVar(&serveOpts.IsDevelopment, `dev`, false, `Turn on development mode.`) flag.StringVar(&serveOpts.Address, `http`, `127.0.0.1:10202`, - `Set HTTP listen address`) + `Set HTTP listen address`) + flag.StringVar(&shutdownIdleDuration, `shutdown-idle`, ``, + `Set the duration to automatically shutdown the server when no new connections after a duration.`) flag.Parse() + var err error + if shutdownIdleDuration != `` { + serveOpts.ShutdownIdleDuration, err = time.ParseDuration(shutdownIdleDuration) + if err != nil { + log.Fatalf(`invalid shutdown-idle value %s: %s`, + shutdownIdleDuration, err) + } + } + var cmd = strings.ToLower(flag.Arg(0)) - var err error switch cmd { case `embed`: err = ciigo.GoEmbed(embedOpts) @@ -3,8 +3,8 @@ module git.sr.ht/~shulhan/go-x-proposal go 1.25.0 require ( - git.sr.ht/~shulhan/ciigo v0.16.0 - git.sr.ht/~shulhan/pakakeh.go v0.61.0 + git.sr.ht/~shulhan/ciigo v0.16.1-0.20260211155053-00dfc937cec1 + git.sr.ht/~shulhan/pakakeh.go v0.61.1-0.20260211152820-e5a9e1e5314a ) require ( @@ -1,9 +1,9 @@ git.sr.ht/~shulhan/asciidoctor-go v0.7.3 h1:QjMMG3AgtnWkAIV2OqPfAksCdgonmY6cQXwyXp1c764= git.sr.ht/~shulhan/asciidoctor-go v0.7.3/go.mod h1:fdqQrwicDfRycH6ovYIQ5NzwbFIryNSsrFn5Gw0IsOk= -git.sr.ht/~shulhan/ciigo v0.16.0 h1:TOwCaD9mm3hRxbVDsmJ46xRyUxLoH257ACI4M+RLcQo= -git.sr.ht/~shulhan/ciigo v0.16.0/go.mod h1:rgj8D5KwmfFw4kGWXnGTdUQatSWy/RUCriNGWz4mQRw= -git.sr.ht/~shulhan/pakakeh.go v0.61.0 h1:a/8kcBX0/sCywDbHNrjTmZ4xdJZUZYoedpH1EVuUkPs= -git.sr.ht/~shulhan/pakakeh.go v0.61.0/go.mod h1:mGR0PxGu4X7Vr2U2/3k4phuPjiFC2seTwJnitk8B4LU= +git.sr.ht/~shulhan/ciigo v0.16.1-0.20260211155053-00dfc937cec1 h1:hQpemB8L4GDncSgJ4/pzmHsptIXdQMYLuYF4pSZ8kUQ= +git.sr.ht/~shulhan/ciigo v0.16.1-0.20260211155053-00dfc937cec1/go.mod h1:81PP/BT/QESHMN4/cCZHZyxoLENjBmjjGF5jh3I6pcE= +git.sr.ht/~shulhan/pakakeh.go v0.61.1-0.20260211152820-e5a9e1e5314a h1:VpuI0dK82MqHO5yaDZyfTn3gOU6noFW1wcJBjSsI5Ms= +git.sr.ht/~shulhan/pakakeh.go v0.61.1-0.20260211152820-e5a9e1e5314a/go.mod h1:cU1ZnE54I0SaI3e1aHAmnMYIXq6N2c7yGbbMpFYOECI= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= |
