-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.go
75 lines (63 loc) · 2.6 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* Copyright © INFINI Ltd. All rights reserved.
* web: https://infinilabs.com
* mail: hello#infini.ltd */
package main
import (
public "infini.sh/coco/.public"
"infini.sh/coco/config"
"infini.sh/coco/modules"
_ "infini.sh/coco/modules"
_ "infini.sh/coco/plugins"
"infini.sh/framework"
api1 "infini.sh/framework/core/api"
"infini.sh/framework/core/global"
"infini.sh/framework/core/module"
"infini.sh/framework/core/vfs"
"infini.sh/framework/modules/api"
"infini.sh/framework/modules/elastic"
"infini.sh/framework/modules/pipeline"
"infini.sh/framework/modules/queue"
queue2 "infini.sh/framework/modules/queue/disk_queue"
"infini.sh/framework/modules/task"
"infini.sh/framework/modules/web"
_ "infini.sh/framework/plugins/badger"
_ "infini.sh/framework/plugins/elastic/bulk_indexing"
_ "infini.sh/framework/plugins/elastic/indexing_merge"
_ "infini.sh/framework/plugins/http"
_ "infini.sh/framework/plugins/queue/consumer"
stats "infini.sh/framework/plugins/stats_statsd"
)
func main() {
terminalHeader := (" ___ ___ ___ ___ _ _____ \n")
terminalHeader += (" / __\\/___\\/ __\\/___\\ /_\\ \\_ \\\n")
terminalHeader += (" / / // // / // // //_\\\\ / /\\/\n")
terminalHeader += ("/ /__/ \\_// /__/ \\_// / _ \\/\\/ /_ \n")
terminalHeader += ("\\____|___/\\____|___/ \\_/ \\_/\\____/ \n\n")
terminalHeader += ("HOME: https://coco.rs/\n\n")
terminalFooter := ("")
app := framework.NewApp("coco", "Coco AI - search, connect, collaborate – all in one place, open-sourced under the GNU AGPLv3.",
config.Version, config.BuildNumber, config.LastCommitLog, config.BuildDate, config.EOLDate, terminalHeader, terminalFooter)
app.IgnoreMainConfigMissing()
app.Init(nil)
vfs.RegisterFS(public.StaticFS{StaticFolder: global.Env().SystemConfig.WebAppConfig.UI.LocalPath,
TrimLeftPath: global.Env().SystemConfig.WebAppConfig.UI.LocalPath,
CheckLocalFirst: global.Env().SystemConfig.WebAppConfig.UI.LocalEnabled,
SkipVFS: !global.Env().SystemConfig.WebAppConfig.UI.VFSEnabled})
api1.HandleUI("/", vfs.FileServer(vfs.VFS()))
defer app.Shutdown()
if app.Setup(func() {
module.RegisterSystemModule(&web.WebModule{})
module.RegisterSystemModule(&api.APIModule{})
module.RegisterSystemModule(&elastic.ElasticModule{})
module.RegisterUserPlugin(&stats.StatsDModule{})
module.RegisterUserPlugin(&task.TaskModule{})
module.RegisterSystemModule(&queue2.DiskQueue{})
module.RegisterUserPlugin(&queue.Module{})
module.RegisterUserPlugin(&pipeline.PipeModule{})
module.RegisterUserPlugin(&modules.Coco{})
module.Start()
}, func() {
}, nil) {
app.Run()
}
}