Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ac06e9a4
authored
Apr 08, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Add CheckSetup function call in main to ensure proper initialization #942
parent
97be874c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
main.go
+4
-1
model/main.go
+1
-2
No files found.
main.go
View file @
ac06e9a4
...
...
@@ -52,6 +52,9 @@ func main() {
if
err
!=
nil
{
common
.
FatalLog
(
"failed to initialize database: "
+
err
.
Error
())
}
model
.
CheckSetup
()
// Initialize SQL Database
err
=
model
.
InitLogDB
()
if
err
!=
nil
{
...
...
@@ -76,7 +79,7 @@ func main() {
model
.
InitOptionMap
()
// Initialize model settings
operation_setting
.
InitModelSettings
()
if
common
.
RedisEnabled
{
// for compatibility with old versions
common
.
MemoryCacheEnabled
=
true
...
...
model/main.go
View file @
ac06e9a4
...
...
@@ -56,7 +56,7 @@ func createRootAccountIfNeed() error {
return
nil
}
func
c
heckSetup
()
{
func
C
heckSetup
()
{
setup
:=
GetSetup
()
if
setup
==
nil
{
// No setup record exists, check if we have a root user
...
...
@@ -244,7 +244,6 @@ func migrateDB() error {
}
err
=
DB
.
AutoMigrate
(
&
Setup
{})
common
.
SysLog
(
"database migrated"
)
checkSetup
()
//err = createRootAccountIfNeed()
return
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment