-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
39 lines (32 loc) · 837 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
package main
import (
"log"
"os"
"path"
)
// ConfigPath - Path to YAML config
const ConfigPath = "/etc/entropy/config.yml"
func main() {
c := &Config{}
if _, err := os.Stat(ConfigPath); os.IsNotExist(err) {
c = CreateDefaultConfig(ConfigPath)
} else {
c = LoadConfig(ConfigPath)
}
if _, err := os.Stat(c.WorkDir); os.IsNotExist(err) {
os.MkdirAll(c.WorkDir, 0644)
}
if _, err := os.Stat(path.Join(c.WorkDir, "volumes")); os.IsNotExist(err) {
os.MkdirAll(path.Join(c.WorkDir, "volumes"), 0644)
}
if _, err := os.Stat(path.Join(c.WorkDir, "mounts")); os.IsNotExist(err) {
os.MkdirAll(path.Join(c.WorkDir, "mounts"), 0644)
}
if !ecluster.CheckNetwork(c.NetworkName) {
_, err := ecluster.CreateNetwork(c.NetworkName)
if err != nil {
log.Fatalln(err.Error())
}
}
eplugin.NewEntropyPlugin().Serve()
}