forked from ergo-services/ergo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathergo.go
28 lines (22 loc) · 899 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
package ergo
import (
"context"
"github.com/ergo-services/ergo/erlang"
"github.com/ergo-services/ergo/gen"
"github.com/ergo-services/ergo/node"
)
// StartNode create new node with name and cookie string
func StartNode(name string, cookie string, opts node.Options) (node.Node, error) {
return StartNodeWithContext(context.Background(), name, cookie, opts)
}
// CreateNodeWithContext create new node with specified context, name and cookie string
func StartNodeWithContext(ctx context.Context, name string, cookie string, opts node.Options) (node.Node, error) {
version := node.Version{
Release: Version,
Prefix: VersionPrefix,
OTP: VersionOTP,
}
// add erlang support application
opts.Applications = append([]gen.ApplicationBehavior{&erlang.KernelApp{}}, opts.Applications...)
return node.StartWithContext(context.WithValue(ctx, "version", version), name, cookie, opts)
}