mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-10 18:05:48 +02:00
feat: add setting for test nginx config command #191
This commit is contained in:
parent
ba4aeb85ca
commit
3ee8ef0523
3 changed files with 13 additions and 0 deletions
|
@ -14,6 +14,7 @@ AccessLogPath = /var/log/nginx/access.log
|
|||
ErrorLogPath = /var/log/nginx/error.log
|
||||
ConfigDir =
|
||||
PIDPath =
|
||||
TestConfigCmd =
|
||||
ReloadCmd =
|
||||
RestartCmd =
|
||||
|
||||
|
|
|
@ -15,6 +15,17 @@ func execShell(cmd string) (out string, err error) {
|
|||
}
|
||||
|
||||
func TestConf() (string, error) {
|
||||
if settings.NginxSettings.TestConfigCmd != "" {
|
||||
out, err := execShell(settings.NginxSettings.TestConfigCmd)
|
||||
|
||||
if err != nil {
|
||||
logger.Error(err)
|
||||
return out, err
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
|
||||
out, err := exec.Command("nginx", "-t").CombinedOutput()
|
||||
if err != nil {
|
||||
logger.Error(err)
|
||||
|
|
|
@ -36,6 +36,7 @@ type Nginx struct {
|
|||
ErrorLogPath string `json:"error_log_path"`
|
||||
ConfigDir string `json:"config_dir"`
|
||||
PIDPath string `json:"pid_path"`
|
||||
TestConfigCmd string `json:"test_config_cmd"`
|
||||
ReloadCmd string `json:"reload_cmd"`
|
||||
RestartCmd string `json:"restart_cmd"`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue