diff options
author | FChannel <> | 2022-05-08 14:57:40 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-19 12:53:29 -0700 |
commit | 580dec5b89215310ce34341e11ff17fe38bdb63a (patch) | |
tree | 894424df66a9d9f7e41805822f29adac8fb490fe /main.go | |
parent | f7bf818d29393ceaccf4d2906557351fa6a4f49f (diff) |
more cleanup, logging and error logging everywhere
things are mostly in place can work on "features" and polish
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() } |