mirror of
https://github.com/nxshock/simplefileshare.git
synced 2025-01-18 11:11:10 +05:00
28 lines
466 B
Go
28 lines
466 B
Go
|
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
|
||
|
}
|