mirror of
https://github.com/nxshock/simplefileshare.git
synced 2025-07-02 00:13:36 +05:00
Move site files to separate embed.FS
This commit is contained in:
parent
15cd01725b
commit
5d632da771
7 changed files with 217 additions and 207 deletions
|
@ -1,15 +1,11 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"html/template"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
//go:embed index.htm
|
||||
var templatesFS embed.FS
|
||||
|
||||
var templates *template.Template
|
||||
|
||||
func initTemplates() error {
|
||||
|
@ -17,11 +13,10 @@ func initTemplates() error {
|
|||
defer log.Debugln("Templates initialization finished.")
|
||||
|
||||
var err error
|
||||
templates, err = template.ParseFS(templatesFS, "*.htm")
|
||||
templates, err = template.ParseFS(siteFS, "site/index.htm")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
templatesFS = embed.FS{} // free memory
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue