mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-22 17:26:03 +03:00
23 lines
521 B
Go
23 lines
521 B
Go
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
|
|
}
|