mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 04:22:25 -06:00
clean up some weirdness in the router (#80)
This commit is contained in:
parent
3568579218
commit
c71e55ecc4
11 changed files with 336 additions and 85 deletions
23
internal/router/template.go
Normal file
23
internal/router/template.go
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package router
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/config"
|
||||
)
|
||||
|
||||
// loadTemplates loads html templates for use by the given engine
|
||||
func loadTemplates(cfg *config.Config, engine *gin.Engine) error {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting current working directory: %s", err)
|
||||
}
|
||||
|
||||
tmPath := filepath.Join(cwd, fmt.Sprintf("%s*", cfg.TemplateConfig.BaseDir))
|
||||
|
||||
engine.LoadHTMLGlob(tmPath)
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue