1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2026-03-09 17:19:46 +00:00
Files
mycorrhiza/main.go

48 lines
1.0 KiB
Go
Raw Normal View History

2020-08-31 22:52:26 +05:00
//go:generate go get -u github.com/valyala/quicktemplate/qtc
//go:generate qtc -dir=assets
//go:generate qtc -dir=views
//go:generate qtc -dir=tree
2020-06-12 21:22:02 +05:00
package main
import (
"github.com/bouncepaw/mycorrhiza/cfg"
2021-04-28 17:12:05 +07:00
"github.com/bouncepaw/mycorrhiza/files"
2020-08-09 01:10:28 +05:00
"github.com/bouncepaw/mycorrhiza/history"
"github.com/bouncepaw/mycorrhiza/hyphae"
2021-02-20 19:03:54 +05:00
"github.com/bouncepaw/mycorrhiza/shroom"
"github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/web"
"log"
"net/http"
"os"
2020-06-12 21:22:02 +05:00
)
func main() {
2020-10-25 20:06:51 +05:00
parseCliArgs()
2021-04-28 17:12:36 +07:00
// It is ok if the path is ""
cfg.ReadConfigFile(cfg.ConfigFilePath)
2021-04-28 17:12:36 +07:00
if err := files.CalculatePaths(); err != nil {
log.Fatal(err)
}
log.Println("Running MycorrhizaWiki")
if err := os.Chdir(cfg.WikiDir); err != nil {
2020-08-19 23:54:23 +05:00
log.Fatal(err)
}
log.Println("Wiki storage directory is", cfg.WikiDir)
hyphae.Index(cfg.WikiDir)
log.Println("Indexed", hyphae.Count(), "hyphae")
2021-04-28 17:12:05 +07:00
user.InitUserDatabase()
history.Start(cfg.WikiDir)
2021-02-20 19:03:54 +05:00
shroom.SetHeaderLinks()
2020-08-09 01:10:28 +05:00
go handleGemini()
web.Init()
log.Fatal(http.ListenAndServe("0.0.0.0:"+cfg.HTTPPort, nil))
2020-06-12 21:22:02 +05:00
}