-
Notifications
You must be signed in to change notification settings - Fork 671
/
main.go
41 lines (33 loc) · 862 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
40
41
// (c) 2021, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package main
import (
"fmt"
"os"
"github.com/ava-labs/avalanchego/app/entry"
"github.com/ava-labs/avalanchego/config"
"github.com/ava-labs/avalanchego/version"
)
func main() {
fs := config.BuildFlagSet()
v, err := config.BuildViper(fs, os.Args[1:])
if err != nil {
fmt.Printf("couldn't configure flags: %s\n", err)
os.Exit(1)
}
processConfig, err := config.GetProcessConfig(v)
if err != nil {
fmt.Printf("couldn't load process config: %s\n", err)
os.Exit(1)
}
if processConfig.DisplayVersionAndExit {
fmt.Print(version.String)
os.Exit(0)
}
nodeConfig, err := config.GetNodeConfig(v, processConfig.BuildDir)
if err != nil {
fmt.Printf("couldn't load node config: %s\n", err)
os.Exit(1)
}
entry.Run(processConfig, nodeConfig)
}