aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorFChannel <>2022-05-08 14:57:40 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commit580dec5b89215310ce34341e11ff17fe38bdb63a (patch)
tree894424df66a9d9f7e41805822f29adac8fb490fe /main.go
parentf7bf818d29393ceaccf4d2906557351fa6a4f49f (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.go48
1 files changed, 30 insertions, 18 deletions
diff --git a/main.go b/main.go
index c1ebcef..039ee61 100644
--- a/main.go
+++ b/main.go
@@ -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()
}