Lindenii Project Forge
Commit info | |
---|---|
ID | 972581d8fc7a4b6dae720fe9d39ee8ae3fd4e3a6 |
Author | Runxi Yu<me@runxiyu.org> |
Author date | Wed, 12 Feb 2025 11:30:39 +0800 |
Committer | Runxi Yu<me@runxiyu.org> |
Committer date | Wed, 12 Feb 2025 11:30:39 +0800 |
Actions | Get patch |
resources: Add schema.sql to source_fs
package main import ( "embed" "html/template" "io/fs" "net/http" ) //go:embed .gitignore LICENSE README.md //go:embed *.go go.mod go.sum //go:embed *.scfg
//go:embed schema.sql
//go:embed static/* templates/* var source_fs embed.FS var source_handler http.Handler func init() { source_handler = http.StripPrefix( "/:/source/", http.FileServer(http.FS(source_fs)), ) } //go:embed templates/* static/* var resources_fs embed.FS var templates *template.Template func load_templates() (err error) { templates, err = template.New("templates").Funcs(template.FuncMap{ "first_line": first_line, "base_name": base_name, }).ParseFS(resources_fs, "templates/*") return err } var static_handler http.Handler func init() { static_fs, err := fs.Sub(resources_fs, "static") if err != nil { panic(err) } static_handler = http.StripPrefix("/:/static/", http.FileServer(http.FS(static_fs))) }