From bc9051fd1a17e793647cf309c973a7feefebd98f Mon Sep 17 00:00:00 2001 From: KushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com> Date: Tue, 2 Nov 2021 16:10:57 -0300 Subject: down to the main package it seems --- main.go | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index b659fd4..187179d 100644 --- a/main.go +++ b/main.go @@ -44,34 +44,46 @@ func init() { } func main() { + var err error CreatedNeededDirectories() - InitCache() - db.ConnectDB() defer db.Close() + db.InitCache() + defer db.CloseCache() + db.RunDatabaseSchema() go MakeCaptchas(DB, 100) - *Key = util.CreateKey(32) + config.Key = util.CreateKey(32) - FollowingBoards = GetActorFollowingDB(DB, Domain) + db.FollowingBoards, err = db.GetActorFollowingDB(config.Domain) + if err != nil { + panic(err) + } go StartupArchive(DB) go CheckInactive(DB) - Boards = GetBoardCollection(DB) + db.Boards, err = db.GetBoardCollection() + if err != nil { + panic(err) + } // root actor is used to follow remote feeds that are not local //name, prefname, summary, auth requirements, restricted - if GetConfigValue("instancename", "") != "" { - CreateNewBoardDB(DB, *CreateNewActor("", GetConfigValue("instancename", ""), GetConfigValue("instancesummary", ""), authReq, false)) - if PublicIndexing == "true" { - AddInstanceToIndex(Domain) + if config.InstanceName != "" { + if _, err = db.CreateNewBoardDB(*CreateNewActor("", config.InstanceName, config.InstanceSummary, authReq, false)); err != nil { + panic(err) + } + + if config.PublicIndexing == "true" { + // TODO: comment out later + //AddInstanceToIndex(config.Domain) } } @@ -83,7 +95,7 @@ func main() { for _, f := range themes { if e := path.Ext(f.Name()); e == ".css" { - Themes = append(Themes, strings.TrimSuffix(f.Name(), e)) + config.Themes = append(config.Themes, strings.TrimSuffix(f.Name(), e)) } } -- cgit v1.2.3