This repository has been archived by the owner on Dec 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.go
65 lines (61 loc) · 4.09 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
package main
import (
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/tywkeene/autobd/node"
"github.com/tywkeene/autobd/options"
"github.com/tywkeene/autobd/server"
"github.com/tywkeene/autobd/utils"
"github.com/tywkeene/autobd/version"
"os"
"runtime"
)
func init() {
options.GetOptions()
version.Print()
if options.Config.Version == true {
os.Exit(0)
}
printLogo()
err := os.Chdir(options.Config.Root)
utils.HandlePanic(err)
}
func printLogo() {
const node = `
█████╗ ██╗ ██╗████████╗ ██████╗ ██████╗ ██████╗ ███╗ ██╗ ██████╗ ██████╗ ███████╗
██╔══██╗██║ ██║╚══██╔══╝██╔═══██╗██╔══██╗██╔══██╗ ████╗ ██║██╔═══██╗██╔══██╗██╔════╝
███████║██║ ██║ ██║ ██║ ██║██████╔╝██║ ██║█████╗██╔██╗ ██║██║ ██║██║ ██║█████╗
██╔══██║██║ ██║ ██║ ██║ ██║██╔══██╗██║ ██║╚════╝██║╚██╗██║██║ ██║██║ ██║██╔══╝
██║ ██║╚██████╔╝ ██║ ╚██████╔╝██████╔╝██████╔╝ ██║ ╚████║╚██████╔╝██████╔╝███████╗
╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚══════╝
Backing you up since whenever...
`
const server = `
█████╗ ██╗ ██╗████████╗ ██████╗ ██████╗ ██████╗ ███████╗███████╗██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██║ ██║╚══██╔══╝██╔═══██╗██╔══██╗██╔══██╗ ██╔════╝██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗
███████║██║ ██║ ██║ ██║ ██║██████╔╝██║ ██║█████╗███████╗█████╗ ██████╔╝██║ ██║█████╗ ██████╔╝
██╔══██║██║ ██║ ██║ ██║ ██║██╔══██╗██║ ██║╚════╝╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██╔══╝ ██╔══██╗
██║ ██║╚██████╔╝ ██║ ╚██████╔╝██████╔╝██████╔╝ ███████║███████╗██║ ██║ ╚████╔╝ ███████╗██║ ██║
╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝
Backing you up since right now...
`
if options.Config.RunNode == true {
fmt.Println(node)
} else {
fmt.Println(server)
}
}
func main() {
if options.Config.Cores > runtime.NumCPU() {
log.Error("Requested processor value greater than number of actual processors, using default")
} else {
runtime.GOMAXPROCS(options.Config.Cores)
}
if options.Config.RunNode == true {
localNode := node.InitNode(options.Config.NodeConfig)
err := localNode.UpdateLoop()
utils.HandlePanic(err)
} else {
server.Launch()
}
}