-
-
Notifications
You must be signed in to change notification settings - Fork 146
/
Copy pathergo.go
41 lines (33 loc) · 876 Bytes
/
ergo.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
package ergo
import (
"runtime/debug"
"ergo.services/ergo/app/system"
"ergo.services/ergo/gen"
"ergo.services/ergo/node"
)
// StartNode starts a new node with given name
func StartNode(name gen.Atom, options gen.NodeOptions) (gen.Node, error) {
var empty gen.Version
if options.Version == empty {
if info, ok := debug.ReadBuildInfo(); ok {
options.Version.Name = info.Main.Path
options.Version.Release = info.Main.Version
for _, setting := range info.Settings {
if setting.Key == "vcs.revision" {
options.Version.Commit = setting.Value
break
}
}
}
}
// add default applications:
defaultApps := []gen.ApplicationBehavior{
system.CreateApp(),
}
options.Applications = append(defaultApps, options.Applications...)
n, err := node.Start(name, options, FrameworkVersion)
if err != nil {
return nil, err
}
return n, nil
}