aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorKushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com>2021-11-02 16:10:57 -0300
committerFChannel <>2022-06-19 12:53:29 -0700
commitbc9051fd1a17e793647cf309c973a7feefebd98f (patch)
treebf16a2176e9129c3921ef6743a6c22781e744064 /main.go
parentd80afd8a49f552c5dc51d8346d40809298fef11f (diff)
down to the main package it seems
Diffstat (limited to 'main.go')
-rw-r--r--main.go32
1 files changed, 22 insertions, 10 deletions
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))
}
}