Skip to content

Commit

Permalink
Init DB only when necessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
nomeguy committed Mar 31, 2022
1 parent 0fc0ba0 commit 7a95b9c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions object/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ import (
)

func InitDb() {
initBuiltInOrganization()
initBuiltInUser()
initBuiltInApplication()
initBuiltInCert()
initBuiltInLdap()
existed := initBuiltInOrganization()
if !existed {
initBuiltInUser()
initBuiltInApplication()
initBuiltInCert()
initBuiltInLdap()
}
}

func initBuiltInOrganization() {
func initBuiltInOrganization() bool {
organization := getOrganization("admin", "built-in")
if organization != nil {
return
return true
}

organization = &Organization{
Expand All @@ -47,6 +49,7 @@ func initBuiltInOrganization() {
Tags: []string{},
}
AddOrganization(organization)
return false
}

func initBuiltInUser() {
Expand Down

0 comments on commit 7a95b9c

Please sign in to comment.