mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15: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
|
ErrorLogPath = /var/log/nginx/error.log
|
||||||
ConfigDir =
|
ConfigDir =
|
||||||
PIDPath =
|
PIDPath =
|
||||||
|
TestConfigCmd =
|
||||||
ReloadCmd =
|
ReloadCmd =
|
||||||
RestartCmd =
|
RestartCmd =
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,17 @@ func execShell(cmd string) (out string, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConf() (string, 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()
|
out, err := exec.Command("nginx", "-t").CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
|
|
|
@ -36,6 +36,7 @@ type Nginx struct {
|
||||||
ErrorLogPath string `json:"error_log_path"`
|
ErrorLogPath string `json:"error_log_path"`
|
||||||
ConfigDir string `json:"config_dir"`
|
ConfigDir string `json:"config_dir"`
|
||||||
PIDPath string `json:"pid_path"`
|
PIDPath string `json:"pid_path"`
|
||||||
|
TestConfigCmd string `json:"test_config_cmd"`
|
||||||
ReloadCmd string `json:"reload_cmd"`
|
ReloadCmd string `json:"reload_cmd"`
|
||||||
RestartCmd string `json:"restart_cmd"`
|
RestartCmd string `json:"restart_cmd"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue