From c71e55ecc4c2381785b5f8ae10af74d8a537d6c3 Mon Sep 17 00:00:00 2001 From: Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com> Date: Wed, 7 Jul 2021 15:46:42 +0200 Subject: clean up some weirdness in the router (#80) --- internal/router/template.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 internal/router/template.go (limited to 'internal/router/template.go') 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 +} -- cgit v1.2.3