1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-02-07 14:40:16 +00:00
mycorrhiza/main.go

52 lines
1.2 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
2021-05-11 13:33:00 +05:00
// Command mycorrhiza is a program that runs a mycorrhiza wiki.
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/static"
"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 ""
2021-05-11 13:33:00 +05:00
cfg.ReadConfigFile()
2021-04-28 17:12:36 +07:00
if err := files.CalculatePaths(); err != nil {
log.Fatal(err)
}
2021-06-12 22:01:24 +07:00
log.Println("Running Mycorrhiza Wiki 1.2.0 indev")
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)
// Init the subsystems:
hyphae.Index(cfg.WikiDir)
2021-04-28 17:12:05 +07:00
user.InitUserDatabase()
2021-05-11 15:14:00 +05:00
history.Start()
2021-02-20 19:03:54 +05:00
shroom.SetHeaderLinks()
2020-08-09 01:10:28 +05:00
// Static files:
static.InitFS(cfg.WikiDir + "/static")
// Network:
go handleGemini()
web.Init()
log.Fatal(http.ListenAndServe("0.0.0.0:"+cfg.HTTPPort, nil))
2020-06-12 21:22:02 +05:00
}