diff options
| -rw-r--r-- | CHANGELOG.adoc | 7 | ||||
| -rw-r--r-- | go.mod | 2 | ||||
| -rw-r--r-- | go.sum | 4 | ||||
| -rw-r--r-- | serve_options.go | 11 | ||||
| -rw-r--r-- | server.go | 1 |
5 files changed, 21 insertions, 4 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index e5d21fe..f4d639b 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -15,6 +15,13 @@ Legend, [#v0_16_0] == ciigo v0.16.0 (2026-xx-xx) +**🌼 all: add field Listener to ServeOptions** + +The field Listener allow passing [net.Listener] instance for accepting +HTTP connection. + +One of the use case is to activate the ciigo serve using systemd.socket(5). + **🌱 all: embed CSS and index HTML template using memfs** Previously, with direct embed, every time we change the CSS or index @@ -7,7 +7,7 @@ go 1.24.0 require ( git.sr.ht/~shulhan/asciidoctor-go v0.7.3-0.20260124143117-f289b7f13a1d - git.sr.ht/~shulhan/pakakeh.go v0.60.3-0.20260115103415-806359d5462f + git.sr.ht/~shulhan/pakakeh.go v0.60.3-0.20260202092811-1e3bb9be8444 github.com/yuin/goldmark v1.7.13 github.com/yuin/goldmark-meta v1.1.0 ) @@ -1,7 +1,7 @@ git.sr.ht/~shulhan/asciidoctor-go v0.7.3-0.20260124143117-f289b7f13a1d h1:rdDzlVPJjgR6Jz84VNEAbdvNypMPtH3O6uEbVYb/7Rk= git.sr.ht/~shulhan/asciidoctor-go v0.7.3-0.20260124143117-f289b7f13a1d/go.mod h1:cY9Ae1vu3OniC7z29twH1/PMJa7ZSSUqbK9QQM4/bhc= -git.sr.ht/~shulhan/pakakeh.go v0.60.3-0.20260115103415-806359d5462f h1:2D3QbPVWg5g91wcuyfY9fuN35NWXvCJAjg7c6YbKSVE= -git.sr.ht/~shulhan/pakakeh.go v0.60.3-0.20260115103415-806359d5462f/go.mod h1:1MkKXbLZRHTcnheeSEbRpGztkym4Yxzh90ep+jCxbDc= +git.sr.ht/~shulhan/pakakeh.go v0.60.3-0.20260202092811-1e3bb9be8444 h1:mqX+Z2dyfChpFOgt6gV9R5AT3oQN3pw4gMbPQLGm1DI= +git.sr.ht/~shulhan/pakakeh.go v0.60.3-0.20260202092811-1e3bb9be8444/go.mod h1:1MkKXbLZRHTcnheeSEbRpGztkym4Yxzh90ep+jCxbDc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= diff --git a/serve_options.go b/serve_options.go index 7e7dacf..a8f2426 100644 --- a/serve_options.go +++ b/serve_options.go @@ -3,7 +3,11 @@ package ciigo -import "git.sr.ht/~shulhan/pakakeh.go/lib/memfs" +import ( + "net" + + "git.sr.ht/~shulhan/pakakeh.go/lib/memfs" +) const ( defAddress = `:8080` @@ -11,6 +15,11 @@ const ( // ServeOptions contains the options to use on Serve function. type ServeOptions struct { + // Listener define the network listener to be used for serving HTTP + // connection. + // The Listener can be activated using systemd socket. + Listener net.Listener + // Mfs contains pointer to variable generated from Generate. // This option is used to use embedded files for serving on HTTP. Mfs *memfs.MemFS @@ -51,6 +51,7 @@ func (ciigo *Ciigo) InitHTTPServer(opts ServeOptions) (err error) { ciigo.serveOpts = opts var httpdOpts = libhttp.ServerOptions{ + Listener: opts.Listener, Memfs: opts.Mfs, Address: opts.Address, EnableIndexHTML: opts.EnableIndexHTML, |
