1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 05:20:26 +00:00
mycorrhiza/main.go

52 lines
1.1 KiB
Go
Raw Normal View History

//go:generate qtc -dir=views
//go:generate qtc -dir=tree
2021-05-11 08:33:00 +00:00
// Command mycorrhiza is a program that runs a mycorrhiza wiki.
2020-06-12 16:22:02 +00:00
package main
import (
2021-06-19 04:51:10 +00:00
"log"
"os"
"github.com/bouncepaw/mycorrhiza/cfg"
2021-04-28 10:12:05 +00:00
"github.com/bouncepaw/mycorrhiza/files"
2020-08-08 20:10:28 +00:00
"github.com/bouncepaw/mycorrhiza/history"
"github.com/bouncepaw/mycorrhiza/hyphae"
2021-02-20 14:03:54 +00:00
"github.com/bouncepaw/mycorrhiza/shroom"
"github.com/bouncepaw/mycorrhiza/static"
"github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/web"
2020-06-12 16:22:02 +00:00
)
func main() {
2020-10-25 15:06:51 +00:00
parseCliArgs()
2021-04-28 10:12:36 +00:00
2021-06-19 04:51:10 +00:00
if err := files.PrepareWikiRoot(); err != nil {
log.Fatal(err)
}
if err := cfg.ReadConfigFile(files.ConfigPath()); err != nil {
log.Fatal(err)
}
2021-07-01 12:22:39 +00:00
log.Println("Running Mycorrhiza Wiki 1.3.0")
2021-06-19 04:51:10 +00:00
if err := os.Chdir(files.HyphaeDir()); err != nil {
2020-08-19 18:54:23 +00:00
log.Fatal(err)
}
2021-06-19 04:51:10 +00:00
log.Println("Wiki directory is", cfg.WikiDir)
log.Println("Using Git storage at", files.HyphaeDir())
// Init the subsystems:
2021-06-19 04:51:10 +00:00
hyphae.Index(files.HyphaeDir())
2021-04-28 10:12:05 +00:00
user.InitUserDatabase()
2021-05-11 10:14:00 +00:00
history.Start()
history.InitGitRepo()
2021-02-20 14:03:54 +00:00
shroom.SetHeaderLinks()
2020-08-08 20:10:28 +00:00
// Static files:
2021-06-19 04:51:10 +00:00
static.InitFS(files.StaticFiles())
// Network:
web.Init()
serveHTTP()
2020-06-12 16:22:02 +00:00
}