mirror of
https://github.com/nxshock/simplefileshare.git
synced 2025-07-02 00:13:36 +05:00
Import project
This commit is contained in:
parent
f0e39831c2
commit
1b0cbbf5cd
13 changed files with 588 additions and 0 deletions
27
templates.go
Normal file
27
templates.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
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 {
|
||||
log.Debugln("Templates initialization started.")
|
||||
defer log.Debugln("Templates initialization finished.")
|
||||
|
||||
var err error
|
||||
templates, err = template.ParseFS(templatesFS, "*.htm")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
templatesFS = embed.FS{} // free memory
|
||||
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue