Remove bugs in main init

This commit is contained in:
Jan Eitzinger 2024-07-20 10:03:14 +02:00
parent c2f72f72ac
commit c4d93e492b
Signed by: moebiusband
GPG Key ID: 2574BA29B90D6DD5
2 changed files with 5 additions and 3 deletions

View File

@ -83,8 +83,6 @@ func main() {
config.Keys.DB = os.Getenv(envvar) config.Keys.DB = os.Getenv(envvar)
} }
repository.Connect(config.Keys.DBDriver, config.Keys.DB)
if flagMigrateDB { if flagMigrateDB {
err := repository.MigrateDB(config.Keys.DBDriver, config.Keys.DB) err := repository.MigrateDB(config.Keys.DBDriver, config.Keys.DB)
if err != nil { if err != nil {
@ -109,6 +107,8 @@ func main() {
os.Exit(0) os.Exit(0)
} }
repository.Connect(config.Keys.DBDriver, config.Keys.DB)
if flagInit { if flagInit {
initEnv() initEnv()
fmt.Print("Succesfully setup environment!\n") fmt.Print("Succesfully setup environment!\n")
@ -227,6 +227,8 @@ func main() {
<-sigs <-sigs
runtimeEnv.SystemdNotifiy(false, "Shutting down ...") runtimeEnv.SystemdNotifiy(false, "Shutting down ...")
serverShutdown()
taskManager.Shutdown() taskManager.Shutdown()
}() }()

View File

@ -75,7 +75,7 @@ func Start() {
lc := config.Keys.LdapConfig lc := config.Keys.LdapConfig
if lc.SyncInterval != "" { if lc != nil && lc.SyncInterval != "" {
RegisterLdapSyncService(lc.SyncInterval) RegisterLdapSyncService(lc.SyncInterval)
} }