mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-12 05:20:26 +00:00
3f7de07da9
This has several advantages over using an external CLI tool to generate the files, such as having fewer dependencies, less generated files bloat and more flexibility over the localization code. "Sadly", this solution doesn't check for validity of JSON files at compile-time (the only advantage of using an external tool such as go-localize). However, I easily fixed this huge "issue" by making the program crash at startup if any locale files are invalid. Also, no more "go-localize removed from go.mod" "go-localize added to go.mod" "go-localize removed from go.mod" spam. A utility for making sure all translation stay in sync soon! (not sure where to put it)
55 lines
1.4 KiB
Go
55 lines
1.4 KiB
Go
//go:generate go run github.com/valyala/quicktemplate/qtc -dir=views
|
|
//go:generate go run github.com/valyala/quicktemplate/qtc -dir=tree
|
|
//go:generate go run github.com/valyala/quicktemplate/qtc -dir=history
|
|
// Command mycorrhiza is a program that runs a mycorrhiza wiki.
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
|
|
|
"github.com/bouncepaw/mycorrhiza/cfg"
|
|
"github.com/bouncepaw/mycorrhiza/files"
|
|
"github.com/bouncepaw/mycorrhiza/history"
|
|
"github.com/bouncepaw/mycorrhiza/hyphae"
|
|
"github.com/bouncepaw/mycorrhiza/shroom"
|
|
"github.com/bouncepaw/mycorrhiza/static"
|
|
"github.com/bouncepaw/mycorrhiza/user"
|
|
"github.com/bouncepaw/mycorrhiza/web"
|
|
)
|
|
|
|
func main() {
|
|
parseCliArgs()
|
|
|
|
if err := files.PrepareWikiRoot(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
if err := cfg.ReadConfigFile(files.ConfigPath()); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
log.Println("Running Mycorrhiza Wiki 1.7.0")
|
|
if err := os.Chdir(files.HyphaeDir()); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
log.Println("Wiki directory is", cfg.WikiDir)
|
|
log.Println("Using Git storage at", files.HyphaeDir())
|
|
|
|
// Init the subsystems:
|
|
hyphae.Index(files.HyphaeDir())
|
|
backlinks.IndexBacklinks()
|
|
go backlinks.RunBacklinksConveyor()
|
|
user.InitUserDatabase()
|
|
history.Start()
|
|
history.InitGitRepo()
|
|
shroom.SetHeaderLinks()
|
|
|
|
// Static files:
|
|
static.InitFS(files.StaticFiles())
|
|
|
|
serveHTTP(web.Handler())
|
|
}
|