Skip to content

Commit 27f7516

Browse files
committed
enhance: removed the ability to modify nginx log path settings online
1 parent abd76ff commit 27f7516

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

api/settings/settings.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package settings
33
import (
44
"github.com/0xJacky/Nginx-UI/api"
55
"github.com/0xJacky/Nginx-UI/internal/cron"
6+
"github.com/0xJacky/Nginx-UI/internal/nginx"
67
"github.com/0xJacky/Nginx-UI/settings"
78
"github.com/gin-gonic/gin"
89
"net/http"
@@ -15,6 +16,8 @@ func GetServerName(c *gin.Context) {
1516
}
1617

1718
func GetSettings(c *gin.Context) {
19+
settings.NginxSettings.AccessLogPath = nginx.GetAccessLogPath()
20+
settings.NginxSettings.ErrorLogPath = nginx.GetErrorLogPath()
1821
c.JSON(http.StatusOK, gin.H{
1922
"server": settings.ServerSettings,
2023
"nginx": settings.NginxSettings,

app/src/views/preference/NginxSettings.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const errors: Record<string, Record<string, string>> = inject('errors') as Recor
1414
? $gettext('File not found')
1515
: ''"
1616
>
17-
<AInput v-model:value="data.nginx.access_log_path" />
17+
{{ data.nginx.access_log_path }}
1818
</AFormItem>
1919
<AFormItem
2020
:label="$gettext('Nginx Error Log Path')"
@@ -23,7 +23,7 @@ const errors: Record<string, Record<string, string>> = inject('errors') as Recor
2323
? $gettext('File not found')
2424
: ''"
2525
>
26-
<AInput v-model:value="data.nginx.error_log_path" />
26+
{{ data.nginx.error_log_path }}
2727
</AFormItem>
2828
</AForm>
2929
</template>

internal/nginx/config_args.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@ func GetConfPath(dir ...string) (confPath string) {
3333
}
3434

3535
joined := filepath.Clean(filepath.Join(confPath, filepath.Join(dir...)))
36-
37-
if !helper.IsUnderDirectory(confPath, joined) {
36+
if !helper.IsUnderDirectory(joined, confPath) {
3837
return confPath
3938
}
40-
41-
return
39+
return joined
4240
}
4341

4442
func GetPIDPath() (path string) {

settings/nginx.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package settings
22

33
type Nginx struct {
4-
AccessLogPath string `json:"access_log_path" binding:"omitempty,file"`
5-
ErrorLogPath string `json:"error_log_path" binding:"omitempty,file"`
4+
AccessLogPath string `json:"access_log_path" protected:"true"`
5+
ErrorLogPath string `json:"error_log_path" protected:"true"`
66
ConfigDir string `json:"config_dir" protected:"true"`
77
PIDPath string `json:"pid_path" protected:"true"`
88
TestConfigCmd string `json:"test_config_cmd" protected:"true"`

0 commit comments

Comments
 (0)