mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-07-04 17:06:49 +00:00
- Added upstream objects
- Renamed host templates to nginx templates - Generate upstream templates - Better nginx error reporting when reloading - Use tparse for golang test reporting
This commit is contained in:
@ -6,7 +6,9 @@ import (
|
||||
|
||||
"npm/internal/entity/certificate"
|
||||
"npm/internal/entity/host"
|
||||
"npm/internal/entity/upstream"
|
||||
"npm/internal/logger"
|
||||
"npm/internal/util"
|
||||
|
||||
"github.com/aymerick/raymond"
|
||||
)
|
||||
@ -17,10 +19,15 @@ type TemplateData struct {
|
||||
DataDir string
|
||||
Host host.Template
|
||||
Certificate certificate.Template
|
||||
Upstream upstream.Model
|
||||
}
|
||||
|
||||
func generateHostConfig(template string, data TemplateData) (string, error) {
|
||||
logger.Debug("Rendering Template - Template: %s", template)
|
||||
logger.Debug("Rendering Template - Data: %+v", data)
|
||||
return raymond.Render(template, data)
|
||||
|
||||
// todo: apply some post processing to this config, stripe trailing whitespace from lines and then remove groups of 2+ \n's so the config looks nicer
|
||||
}
|
||||
|
||||
func writeTemplate(filename, template string, data TemplateData) error {
|
||||
@ -31,7 +38,7 @@ func writeTemplate(filename, template string, data TemplateData) error {
|
||||
|
||||
// Write it. This will also write an error comment if generation failed
|
||||
// nolint: gosec
|
||||
writeErr := writeConfigFile(filename, output)
|
||||
writeErr := writeConfigFile(filename, util.CleanupWhitespace(output))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user