1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 05:20:26 +00:00
mycorrhiza/main.go
handlerug 295c209472
Port -> listen address
It allows for more control and things like listening on Unix sockets or
binding to 127.0.0.1 rather than 0.0.0.0.

Config changes:
- "Port = 1737" changed to "ListenAddr = 127.0.0.1:1737"
- new env variable LISTEN_ADDR
2021-07-05 21:35:27 +07:00

52 lines
1.1 KiB
Go

//go:generate qtc -dir=views
//go:generate qtc -dir=tree
// Command mycorrhiza is a program that runs a mycorrhiza wiki.
package main
import (
"log"
"os"
"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.3.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())
user.InitUserDatabase()
history.Start()
history.InitGitRepo()
shroom.SetHeaderLinks()
// Static files:
static.InitFS(files.StaticFiles())
// Network:
web.Init()
serveHTTP()
}