mirror of
https://github.com/oarkflow/mq.git
synced 2025-10-06 08:26:52 +08:00
update
This commit is contained in:
@@ -837,6 +837,7 @@ type RequestSchemaTemplate struct {
|
|||||||
|
|
||||||
var cache = make(map[string]*RequestSchemaTemplate)
|
var cache = make(map[string]*RequestSchemaTemplate)
|
||||||
var mu = &sync.Mutex{}
|
var mu = &sync.Mutex{}
|
||||||
|
var BaseTemplateDir = "templates"
|
||||||
|
|
||||||
func Get(schemaPath, template string) (*JSONSchemaRenderer, error) {
|
func Get(schemaPath, template string) (*JSONSchemaRenderer, error) {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
@@ -857,7 +858,7 @@ func Get(schemaPath, template string) (*JSONSchemaRenderer, error) {
|
|||||||
return nil, fmt.Errorf("error compiling schema: %w", err)
|
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)
|
htmlLayout, err := os.ReadFile(templatePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to load template: %w", err)
|
return nil, fmt.Errorf("failed to load template: %w", err)
|
||||||
|
Reference in New Issue
Block a user