mirror of
https://github.com/khairul169/vaulterm.git
synced 2026-09-15 17:03:30 +07:00
feat: add desktop build using wails
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"rul.sh/vaulterm/server/lib"
|
||||
)
|
||||
|
||||
func CheckAndCreateEnvFile() error {
|
||||
// Check if .env file exists
|
||||
if _, err := os.Stat(".env"); !os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// File doesn't exist, so create it
|
||||
randomKey, err := lib.GenerateRandomKey()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Write the random key to the .env file
|
||||
envContent := fmt.Sprintf("ENCRYPTION_KEY=%s\n", randomKey)
|
||||
err = os.WriteFile(".env", []byte(envContent), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(".env file created with ENCRYPTION_KEY.")
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package utils
|
||||
import (
|
||||
"github.com/gofiber/contrib/websocket"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"rul.sh/vaulterm/middleware"
|
||||
"rul.sh/vaulterm/server/middleware"
|
||||
)
|
||||
|
||||
type UserContext = middleware.AuthUser
|
||||
|
||||
Reference in New Issue
Block a user