-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
49 lines (39 loc) · 985 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"flag"
"github.com/oolong-sh/oolongd/internal/config"
"github.com/oolong-sh/oolongd/internal/daemon"
"github.com/oolong-sh/oolongd/internal/db"
"github.com/oolong-sh/oolongd/internal/documents"
"github.com/oolong-sh/oolongd/internal/linking/ngrams"
"github.com/oolong-sh/oolongd/internal/state"
)
var daemonFlag = flag.Bool("no-daemon", false, "Run Oolong in no-daemon mode (not recommended)")
func main() {
// read in config
if err := config.Setup(); err != nil {
panic(err)
}
// merge stop words from config
ngrams.MergeStopWords()
// initialize state
state.InitState()
// read notes directories
if err := documents.ReadNotesDirs(); err != nil {
panic(err)
}
go func() {
if config.PinningEnabled() {
if err := db.InitializeDB(); err != nil {
panic(err)
}
defer db.CloseDB()
}
}()
// go plugins.InitPlugins()
// run daemon if --no-daemon flag is not passed
flag.Parse()
if !*daemonFlag {
daemon.Run()
}
}