diff options
Diffstat (limited to 'internal/router/template.go')
-rw-r--r-- | internal/router/template.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/router/template.go b/internal/router/template.go new file mode 100644 index 000000000..cd1eb11db --- /dev/null +++ b/internal/router/template.go @@ -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 +} |