diff options
| author | Hamidreza <70919649+hamid-gh98@users.noreply.github.com> | 2024-03-13 10:54:41 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-13 10:54:41 +0300 |
| commit | 569c9428fb7924fb693605385f745e4bf524dc20 (patch) | |
| tree | dba6587b61f2f845c422d7a4fe29d3c8b59da2e0 /xray | |
| parent | 97489e743abe004a3d4865746c4c7f261aca4e10 (diff) | |
[iplimit] fix access log path in settings service (#2044)
* [iplimit] fix access log path in settings service
better to avoid hardcoding the access log path to enhance flexibility. not all users prefer the default './access.log'
* [iplimit] fix iplimit
Diffstat (limited to 'xray')
| -rw-r--r-- | xray/process.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/xray/process.go b/xray/process.go index fcbe6f78..3203d7cd 100644 --- a/xray/process.go +++ b/xray/process.go @@ -57,28 +57,28 @@ func GetAccessPersistentPrevLogPath() string { return config.GetLogFolder() + "/3xipl-ap.prev.log" } -func GetAccessLogPath() string { +func GetAccessLogPath() (string, error) { config, err := os.ReadFile(GetConfigPath()) if err != nil { logger.Warningf("Something went wrong: %s", err) + return "", err } jsonConfig := map[string]interface{}{} err = json.Unmarshal([]byte(config), &jsonConfig) if err != nil { logger.Warningf("Something went wrong: %s", err) + return "", err } if jsonConfig["log"] != nil { jsonLog := jsonConfig["log"].(map[string]interface{}) if jsonLog["access"] != nil { - accessLogPath := jsonLog["access"].(string) - - return accessLogPath + return accessLogPath, nil } } - return "" + return "", err } func stopProcess(p *Process) { @@ -203,7 +203,7 @@ func (p *process) Start() (err error) { return common.NewErrorf("Failed to generate xray configuration file: %v", err) } - err = os.MkdirAll(config.GetLogFolder(), 0770) + err = os.MkdirAll(config.GetLogFolder(), 0o770) if err != nil { logger.Warningf("Something went wrong: %s", err) } |
