Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorHo3ein <ho3ein.sanaei@gmail.com>2023-04-14 04:58:03 +0300
committerGitHub <noreply@github.com>2023-04-14 04:58:03 +0300
commitb70ecc12b3870fe7ed77242b77369008de4b5441 (patch)
treed93f5233a3ee0514cfece964c68d28afe30ebbac /config
parent0c047cf1245411394d77c3d7880bfc7466716856 (diff)
parent4f952963aea1c51c65cc8419abda31e2bfd8f5ea (diff)
Merge pull request #261 from hamid-gh98/main
Support set db and bin folder path from env
Diffstat (limited to 'config')
-rw-r--r--config/config.go18
1 files changed, 17 insertions, 1 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 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("/etc/%s/%s.db", GetName(), GetName())
+ return fmt.Sprintf("%s/%s.db", GetDBFolderPath(), GetName())
}