mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 18:35:51 +02:00
enhance: translations
This commit is contained in:
parent
f31407dd7e
commit
e8f1321e0c
45 changed files with 4009 additions and 2375 deletions
61
internal/self_check/tasks.go
Normal file
61
internal/self_check/tasks.go
Normal file
|
@ -0,0 +1,61 @@
|
|||
package self_check
|
||||
|
||||
import (
|
||||
"github.com/0xJacky/Nginx-UI/internal/helper"
|
||||
"github.com/uozi-tech/cosy"
|
||||
)
|
||||
|
||||
type Task struct {
|
||||
Name string
|
||||
CheckFunc func() error
|
||||
FixFunc func() error
|
||||
}
|
||||
|
||||
type Report struct {
|
||||
Name string `json:"name"`
|
||||
Err *cosy.Error `json:"err,omitempty"`
|
||||
}
|
||||
|
||||
type Reports []*Report
|
||||
|
||||
var selfCheckTasks = []*Task{
|
||||
{
|
||||
Name: "Directory-Sites",
|
||||
CheckFunc: CheckSitesDirectory,
|
||||
FixFunc: FixSitesDirectory,
|
||||
},
|
||||
{
|
||||
Name: "Directory-Streams",
|
||||
CheckFunc: CheckStreamDirectory,
|
||||
FixFunc: FixStreamDirectory,
|
||||
},
|
||||
{
|
||||
Name: "NginxConf-Sites-Enabled",
|
||||
CheckFunc: CheckNginxConfIncludeSites,
|
||||
FixFunc: FixNginxConfIncludeSites,
|
||||
},
|
||||
{
|
||||
Name: "NginxConf-Streams-Enabled",
|
||||
CheckFunc: CheckNginxConfIncludeStreams,
|
||||
FixFunc: FixNginxConfIncludeStreams,
|
||||
},
|
||||
{
|
||||
Name: "NginxConf-ConfD",
|
||||
CheckFunc: CheckNginxConfIncludeConfD,
|
||||
FixFunc: FixNginxConfIncludeConfD,
|
||||
},
|
||||
}
|
||||
|
||||
var selfCheckTaskMap = make(map[string]*Task)
|
||||
|
||||
func init() {
|
||||
for _, task := range selfCheckTasks {
|
||||
selfCheckTaskMap[task.Name] = task
|
||||
}
|
||||
if helper.InNginxUIOfficialDocker() {
|
||||
selfCheckTasks = append(selfCheckTasks, &Task{
|
||||
Name: "Docker-Socket",
|
||||
CheckFunc: CheckDockerSocket,
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue