feat(static): release static files into memory while startup (#1471)

* 初始化时解压zip文件读取内存中

* update go.mod

* 更新各种go版本
This commit is contained in:
WeidiDeng
2022-10-15 09:05:05 +08:00
committed by GitHub
parent 63b536e5db
commit f89653cea7
9 changed files with 516 additions and 16 deletions

View File

@@ -4,13 +4,11 @@ import (
"context"
_ "embed"
"flag"
"io"
"io/fs"
"net"
"net/http"
"os"
"os/signal"
"strings"
"syscall"
"time"
@@ -19,8 +17,6 @@ import (
"github.com/cloudreve/Cloudreve/v3/pkg/conf"
"github.com/cloudreve/Cloudreve/v3/pkg/util"
"github.com/cloudreve/Cloudreve/v3/routers"
"github.com/mholt/archiver/v4"
)
var (
@@ -40,10 +36,7 @@ func init() {
flag.StringVar(&scriptName, "database-script", "", "Name of database util script.")
flag.Parse()
staticFS = archiver.ArchiveFS{
Stream: io.NewSectionReader(strings.NewReader(staticZip), 0, int64(len(staticZip))),
Format: archiver.Zip{},
}
staticFS = bootstrap.NewFS(staticZip)
bootstrap.Init(confPath, staticFS)
}