This commit is contained in:
sujit
2025-08-05 09:55:29 +05:45
parent 0089bb828d
commit c55b34f273

View File

@@ -837,6 +837,7 @@ type RequestSchemaTemplate struct {
var cache = make(map[string]*RequestSchemaTemplate)
var mu = &sync.Mutex{}
var BaseTemplateDir = "templates"
func Get(schemaPath, template string) (*JSONSchemaRenderer, error) {
mu.Lock()
@@ -857,7 +858,7 @@ func Get(schemaPath, template string) (*JSONSchemaRenderer, error) {
return nil, fmt.Errorf("error compiling schema: %w", err)
}
templatePath := fmt.Sprintf("templates/%s.html", template)
templatePath := fmt.Sprintf("%s/%s.html", BaseTemplateDir, template)
htmlLayout, err := os.ReadFile(templatePath)
if err != nil {
return nil, fmt.Errorf("failed to load template: %w", err)