From 4548755375b1a0d87812a1e32c0a2f63d9f0e5e2 Mon Sep 17 00:00:00 2001 From: Hamidreza Ghavami Date: Fri, 14 Apr 2023 00:03:46 +0430 Subject: [PATCH] update db config path --- config/config.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index e1c7f911..e3fe1709 100644 --- a/config/config.go +++ b/config/config.go @@ -45,6 +45,22 @@ func IsDebug() bool { return os.Getenv("XUI_DEBUG") == "true" } -func GetDBPath() string { - return fmt.Sprintf("/etc/%s/%s.db", GetName(), GetName()) +func GetBinFolderPath() string { + binFolderPath := os.Getenv("XUI_BIN_FOLDER") + if binFolderPath == "" { + binFolderPath = "bin" + } + return binFolderPath +} + +func GetDBFolderPath() string { + dbFolderPath := os.Getenv("XUI_DB_FOLDER") + if dbFolderPath == "" { + dbFolderPath = "/etc/x-ui" + } + return dbFolderPath +} + +func GetDBPath() string { + return fmt.Sprintf("%s/%s.db", GetDBFolderPath(), GetName()) }