You've already forked CasaOS
mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-07-12 23:50:14 +02:00
remove /DATA directory initialization - moved to local-storage (#578)
This commit is contained in:
@ -28,15 +28,18 @@ const (
|
||||
casaosServiceName = "casaos.service"
|
||||
)
|
||||
|
||||
var _logger *Logger
|
||||
var sqliteDB *gorm.DB
|
||||
var (
|
||||
_logger *Logger
|
||||
sqliteDB *gorm.DB
|
||||
)
|
||||
|
||||
var configFlag = ""
|
||||
var dbFlag = ""
|
||||
var (
|
||||
configFlag = ""
|
||||
dbFlag = ""
|
||||
)
|
||||
|
||||
func init() {
|
||||
config.InitSetup(configFlag)
|
||||
config.UpdateSetup()
|
||||
|
||||
if len(dbFlag) == 0 {
|
||||
dbFlag = config.AppInfo.DBPath + "/db"
|
||||
@ -47,6 +50,7 @@ func init() {
|
||||
|
||||
service.MyService = service.NewService(sqliteDB, "")
|
||||
}
|
||||
|
||||
func main() {
|
||||
versionFlag := flag.Bool("v", false, "version")
|
||||
debugFlag := flag.Bool("d", true, "debug")
|
||||
|
10
main.go
10
main.go
@ -28,9 +28,11 @@ const LOCALHOST = "127.0.0.1"
|
||||
|
||||
var sqliteDB *gorm.DB
|
||||
|
||||
var configFlag = flag.String("c", "", "config address")
|
||||
var dbFlag = flag.String("db", "", "db path")
|
||||
var versionFlag = flag.Bool("v", false, "version")
|
||||
var (
|
||||
configFlag = flag.String("c", "", "config address")
|
||||
dbFlag = flag.String("db", "", "db path")
|
||||
versionFlag = flag.Bool("v", false, "version")
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.Parse()
|
||||
@ -39,7 +41,6 @@ func init() {
|
||||
return
|
||||
}
|
||||
config.InitSetup(*configFlag)
|
||||
config.UpdateSetup()
|
||||
|
||||
loger.LogInit()
|
||||
if len(*dbFlag) == 0 {
|
||||
@ -60,7 +61,6 @@ func init() {
|
||||
|
||||
// go service.LoopFriend()
|
||||
// go service.MyService.App().CheckNewImage()
|
||||
|
||||
}
|
||||
|
||||
// @title casaOS API
|
||||
|
@ -1,32 +0,0 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"github.com/IceWhaleTech/CasaOS/pkg/utils/file"
|
||||
)
|
||||
|
||||
//检查目录是否存在
|
||||
func mkdirDATAAll() {
|
||||
sysType := runtime.GOOS
|
||||
var dirArray []string
|
||||
if sysType == "linux" {
|
||||
dirArray = []string{"/DATA/AppData", "/DATA/Documents", "/DATA/Downloads", "/DATA/Gallery", "/DATA/Media/Movies", "/DATA/Media/TV Shows", "/DATA/Media/Music"}
|
||||
}
|
||||
|
||||
if sysType == "windows" {
|
||||
dirArray = []string{"C:\\CasaOS\\DATA\\AppData", "C:\\CasaOS\\DATA\\Documents", "C:\\CasaOS\\DATA\\Downloads", "C:\\CasaOS\\DATA\\Gallery", "C:\\CasaOS\\DATA\\Media/Movies", "C:\\CasaOS\\DATA\\Media\\TV Shows", "C:\\CasaOS\\DATA\\Media\\Music"}
|
||||
}
|
||||
if sysType == "darwin" {
|
||||
dirArray = []string{"./CasaOS/DATA/AppData", "./CasaOS/DATA/Documents", "./CasaOS/DATA/Downloads", "./CasaOS/DATA/Gallery", "./CasaOS/DATA/Media/Movies", "./CasaOS/DATA/Media/TV Shows", "./CasaOS/DATA/Media/Music"}
|
||||
}
|
||||
|
||||
for _, v := range dirArray {
|
||||
file.IsNotExistMkDir(v)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func UpdateSetup() {
|
||||
mkdirDATAAll()
|
||||
}
|
Reference in New Issue
Block a user