mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
fix: user curd panic after install
This commit is contained in:
parent
c5bd8cc580
commit
d83272d5b8
6 changed files with 16 additions and 24 deletions
|
@ -3,6 +3,10 @@ package kernel
|
|||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"mime"
|
||||
"path"
|
||||
"runtime"
|
||||
|
||||
"github.com/0xJacky/Nginx-UI/internal/analytic"
|
||||
"github.com/0xJacky/Nginx-UI/internal/cache"
|
||||
"github.com/0xJacky/Nginx-UI/internal/cert"
|
||||
|
@ -17,10 +21,8 @@ import (
|
|||
"github.com/uozi-tech/cosy"
|
||||
sqlite "github.com/uozi-tech/cosy-driver-sqlite"
|
||||
"github.com/uozi-tech/cosy/logger"
|
||||
cModel "github.com/uozi-tech/cosy/model"
|
||||
cSettings "github.com/uozi-tech/cosy/settings"
|
||||
"mime"
|
||||
"path"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func Boot() {
|
||||
|
@ -73,12 +75,13 @@ func recovery() {
|
|||
}
|
||||
|
||||
func InitDatabase() {
|
||||
cModel.ResolvedModels()
|
||||
// Skip install
|
||||
if settings.NodeSettings.SkipInstallation {
|
||||
skipInstall()
|
||||
}
|
||||
|
||||
if "" != cSettings.AppSettings.JwtSecret {
|
||||
if cSettings.AppSettings.JwtSecret != "" {
|
||||
db := cosy.InitDB(sqlite.Open(path.Dir(cSettings.ConfPath), settings.DatabaseSettings))
|
||||
model.Use(db)
|
||||
query.Init(db)
|
||||
|
@ -88,7 +91,7 @@ func InitDatabase() {
|
|||
}
|
||||
|
||||
func InitNodeSecret() {
|
||||
if "" == settings.NodeSettings.Secret {
|
||||
if settings.NodeSettings.Secret == "" {
|
||||
logger.Info("Secret is empty, generating...")
|
||||
uuidStr := uuid.New().String()
|
||||
settings.NodeSettings.Secret = uuidStr
|
||||
|
@ -102,7 +105,7 @@ func InitNodeSecret() {
|
|||
}
|
||||
|
||||
func InitCryptoSecret() {
|
||||
if "" == settings.CryptoSettings.Secret {
|
||||
if settings.CryptoSettings.Secret == "" {
|
||||
logger.Info("Secret is empty, generating...")
|
||||
|
||||
key := make([]byte, 32)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue