mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
36 lines
706 B
Go
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)
|
|
}
|
|
}
|
|
}
|