From 5b45b53696595d842c6f3131a554ddd9ce4f554a Mon Sep 17 00:00:00 2001 From: Hamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com> Date: Sun, 25 Jun 2023 03:18:00 +0430 Subject: [PATCH] add env for log folder XUI_LOG_FOLDER --- README.md | 1 + config/config.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 17e42894..9f6325ed 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,7 @@ Reference syntax: | XUI_DEBUG | `boolean` | `false` | | XUI_BIN_FOLDER | `string` | `"bin"` | | XUI_DB_FOLDER | `string` | `"/etc/x-ui"` | +| XUI_LOG_FOLDER | `string` | `"/var/log"` | Example: diff --git a/config/config.go b/config/config.go index 30f0ca81..70be5ae6 100644 --- a/config/config.go +++ b/config/config.go @@ -65,3 +65,11 @@ func GetDBFolderPath() string { func GetDBPath() string { return fmt.Sprintf("%s/%s.db", GetDBFolderPath(), GetName()) } + +func GetLogFolder() string { + logFolderPath := os.Getenv("XUI_LOG_FOLDER") + if logFolderPath == "" { + logFolderPath = "/var/log" + } + return logFolderPath +}