aboutsummaryrefslogtreecommitdiff
path: root/httpd.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-01-12 00:17:30 +0700
committerShulhan <ms@kilabit.info>2021-01-12 02:56:47 +0700
commit8d9baf80072921975f6b6ce8dc049b8f8a344fb3 (patch)
tree4d6141e3904123949db00421ad886b4ab9f8496c /httpd.go
parent71da98489f4809a6ebc53f6a95d13efae1dd6396 (diff)
downloadrescached-8d9baf80072921975f6b6ce8dc049b8f8a344fb3.tar.xz
all: update with latest share modules
This changes affect how the memfs.New and GoGenenerate called, does not affect the user.
Diffstat (limited to 'httpd.go')
-rw-r--r--httpd.go24
1 files changed, 15 insertions, 9 deletions
diff --git a/httpd.go b/httpd.go
index 7811088..90d90cd 100644
--- a/httpd.go
+++ b/httpd.go
@@ -19,11 +19,14 @@ import (
"github.com/shuLhan/share/lib/dns"
liberrors "github.com/shuLhan/share/lib/errors"
"github.com/shuLhan/share/lib/http"
+ "github.com/shuLhan/share/lib/memfs"
libnet "github.com/shuLhan/share/lib/net"
)
+var memFS *memfs.MemFS
+
const (
- defHTTPDRootDir = "_public/"
+ defHTTPDRootDir = "_www/public/"
paramNameDomain = "domain"
paramNameName = "name"
paramNameQuery = "query"
@@ -40,21 +43,24 @@ const (
func (srv *Server) httpdInit() (err error) {
env := &http.ServerOptions{
- Root: defHTTPDRootDir,
- Address: srv.env.WUIListen,
- Includes: []string{
- `.*\.css`,
- `.*\.html`,
- `.*\.js`,
- `.*\.png`,
+ Options: memfs.Options{
+ Root: defHTTPDRootDir,
+ Includes: []string{
+ `.*\.css`,
+ `.*\.html`,
+ `.*\.js`,
+ `.*\.png`,
+ },
+ Development: srv.env.Debug >= 3,
},
+ Memfs: memFS,
+ Address: srv.env.WUIListen,
CORSAllowOrigins: []string{
"http://127.0.0.1:5000",
},
CORSAllowHeaders: []string{
http.HeaderContentType,
},
- Development: srv.env.Debug >= 3,
}
srv.httpd, err = http.NewServer(env)