diff options
| author | Shulhan <ms@kilabit.info> | 2026-02-07 16:03:19 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2026-02-07 16:03:19 +0700 |
| commit | 3714f15bf29cfb79c3623784e391a7a4854f6815 (patch) | |
| tree | 09913bd02652a11dd1b894c0e2093f78f522548c /serve_options.go | |
| parent | 759c9b8e542d2ce159228e35c6d4138fbaef25de (diff) | |
| download | ciigo-3714f15bf29cfb79c3623784e391a7a4854f6815.tar.xz | |
all: embed struct [lib/http.ServerOptions] directly to [ServeOptions]
At this point, all of the fields in the struct ServeOptions is the
same with [lib/http.ServerOptions] except IsDevelopment and
ConvertOptions.
For field IsDevelopment we keep in the struct.
For field ConvertOptions we remove it and let the caller pass it on
Serve function or InitHTTPServer method.
Diffstat (limited to 'serve_options.go')
| -rw-r--r-- | serve_options.go | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/serve_options.go b/serve_options.go index a8f2426..2725959 100644 --- a/serve_options.go +++ b/serve_options.go @@ -3,37 +3,16 @@ package ciigo -import ( - "net" - - "git.sr.ht/~shulhan/pakakeh.go/lib/memfs" -) +import "git.sr.ht/~shulhan/pakakeh.go/lib/http" const ( defAddress = `:8080` ) -// ServeOptions contains the options to use on Serve function. +// ServeOptions define the options to use on Serve function. +// See [git.sr.ht/~shulhan/pakakeh.go/lib/http.ServerOptions] for more information. 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 - - // Address to listen and serve for HTTP request. - Address string - - ConvertOptions - - // If true, the serve command generate index.html automatically if its - // not exist in the directory. - // The index.html contains the list of files inside the requested - // path. - EnableIndexHTML bool + http.ServerOptions // IsDevelopment if set to true, it will serve the ConvertOptions.Root // directory directly and watch all asciidoc files for changes and @@ -42,13 +21,8 @@ type ServeOptions struct { IsDevelopment bool } -func (opts *ServeOptions) init() (err error) { - err = opts.ConvertOptions.init() - if err != nil { - return err - } +func (opts *ServeOptions) init() { if len(opts.Address) == 0 { opts.Address = defAddress } - return nil } |
