diff options
| author | Ho3ein <ho3ein.sanaei@gmail.com> | 2023-04-14 04:58:03 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-14 04:58:03 +0300 |
| commit | b70ecc12b3870fe7ed77242b77369008de4b5441 (patch) | |
| tree | d93f5233a3ee0514cfece964c68d28afe30ebbac /config | |
| parent | 0c047cf1245411394d77c3d7880bfc7466716856 (diff) | |
| parent | 4f952963aea1c51c65cc8419abda31e2bfd8f5ea (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.go | 18 |
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()) } |
