diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 48 |
1 files changed, 30 insertions, 18 deletions
@@ -1,7 +1,6 @@ package main import ( - "log" "math/rand" "time" @@ -41,7 +40,7 @@ func main() { cookieKey, err := util.GetCookieKey() if err != nil { - log.Println(err) + config.Log.Println(err) } app.Use(encryptcookie.New(encryptcookie.Config{ @@ -107,38 +106,51 @@ func main() { } func Init() { + var actor activitypub.Actor var err error rand.Seed(time.Now().UnixNano()) - util.CreatedNeededDirectories() + if err = util.CreatedNeededDirectories(); err != nil { + config.Log.Println(err) + } - db.ConnectDB() + if err = db.Connect(); err != nil { + config.Log.Println(err) + } - db.RunDatabaseSchema() + if err = db.RunDatabaseSchema(); err != nil { + config.Log.Println(err) + } - actor, _ := activitypub.GetActorFromDB(config.Domain) - webfinger.FollowingBoards, err = actor.GetFollowing() + if actor, err = activitypub.GetActorFromDB(config.Domain); err != nil { + config.Log.Println(err) + } - if err != nil { - panic(err) + if webfinger.FollowingBoards, err = actor.GetFollowing(); err != nil { + config.Log.Println(err) } - webfinger.Boards, err = webfinger.GetBoardCollection() + if webfinger.Boards, err = webfinger.GetBoardCollection(); err != nil { + config.Log.Println(err) + } - if err != nil { - panic(err) + if config.Key, err = util.CreateKey(32); err != nil { + config.Log.Println(err) } - config.Key = util.CreateKey(32) + if err = util.LoadThemes(); err != nil { + config.Log.Println(err) + } - go db.MakeCaptchas(100) + if err = db.InitInstance(); err != nil { + config.Log.Println(err) + } - go db.StartupArchive() + go webfinger.StartupArchive() - go db.CheckInactive() + go util.MakeCaptchas(100) - db.InitInstance() + go db.CheckInactive() - util.LoadThemes() } |