mirror of
https://github.com/khairul169/vaulterm.git
synced 2026-09-15 17:03:30 +07:00
fix: macos fix can't open the app
This commit is contained in:
+12
-2
@@ -1,6 +1,9 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/middleware/cors"
|
||||
"github.com/joho/godotenv"
|
||||
@@ -13,8 +16,15 @@ import (
|
||||
func NewApp() *fiber.App {
|
||||
// Load deps
|
||||
utils.CheckAndCreateEnvFile()
|
||||
godotenv.Load()
|
||||
db.Init()
|
||||
godotenv.Load(utils.GetDataPath(".env"))
|
||||
|
||||
dbUrl := os.Getenv("DATABASE_URL")
|
||||
if dbUrl == "" {
|
||||
// WAL: _journal_mode=WAL
|
||||
dbPath := utils.GetDataPath("data.db")
|
||||
dbUrl = fmt.Sprintf("file:%s?cache=shared&mode=rwc", dbPath)
|
||||
}
|
||||
db.Init(dbUrl)
|
||||
|
||||
// Create fiber app
|
||||
app := fiber.New(fiber.Config{ErrorHandler: ErrorHandler})
|
||||
|
||||
Reference in New Issue
Block a user