소스 검색

update db config path

Hamidreza Ghavami 1 년 전
부모
커밋
4548755375
1개의 변경된 파일17개의 추가작업 그리고 1개의 파일을 삭제
  1. 17 1
      config/config.go

+ 17 - 1
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())
 }