bugfixes more search results and dump restore options

This commit is contained in:
ston1th 2016-11-17 21:21:16 +01:00
commit 3cd460318a
124 changed files with 3915 additions and 9579 deletions

24
main.go
View file

@ -32,6 +32,7 @@ const (
welcome = `# Welcome to GoWiki
This is the [Index](/wiki/Index) page.
You can customize it how you like.`
indexName = "Index"
)
var (
@ -44,6 +45,9 @@ var (
engine *Engine
db *BoltStore
dump bool
restore bool
)
func main() {
@ -53,8 +57,26 @@ func main() {
flag.StringVar(&listen, "l", defListen, "listening <address>:<port>")
flag.StringVar(&logfile, "log", defLog, "log file")
flag.BoolVar(&secureCookie, "s", false, "enable secure cookie")
flag.BoolVar(&dump, "dump", false, "create a json dump of all articles in the data directory (dump is written to stdout)")
flag.BoolVar(&restore, "restore", false, "restore a json dump to the data directory (dump is read from stdin)")
flag.Parse()
if dump {
err := dumpWiki()
if err != nil {
logger.Fatal("dump: ", err)
}
return
}
if restore {
err := restoreWiki()
if err != nil {
logger.Fatal("restore: ", err)
}
return
}
cfg := godrop.Config{
User: user,
Group: group,
@ -93,7 +115,7 @@ func main() {
log.Fatal("main: ", err)
}
engine = NewEngine(index)
_, err = engine.Index("Index", welcome, defUser, true)
_, err = engine.Index(indexName, welcome, defUser, true)
if err != nil {
log.Fatal("main: ", err)
}