nginx-proxy-manager/backend/internal/config/folders.go
Jamie Curnow 5e5f0de0e2 - Added upstream objects
- Renamed host templates to nginx templates
- Generate upstream templates
- Better nginx error reporting when reloading
- Use tparse for golang test reporting
2023-01-04 15:53:52 +10:00

36 lines
706 B
Go

package config
import (
"fmt"
"npm/internal/logger"
"os"
)
// createDataFolders will recursively create these folders within the
// data folder defined in configuration.
func createDataFolders() {
folders := []string{
"access",
"certificates",
"logs",
// Acme.sh:
Configuration.Acmesh.GetWellknown(),
// Nginx:
"nginx/hosts",
"nginx/streams",
"nginx/temp",
"nginx/upstreams",
}
for _, folder := range folders {
path := folder
if path[0:1] != "/" {
path = fmt.Sprintf("%s/%s", Configuration.DataFolder, folder)
}
logger.Debug("Creating folder: %s", path)
if err := os.MkdirAll(path, os.ModePerm); err != nil {
logger.Error("CreateDataFolderError", err)
}
}
}