-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcore.go
47 lines (43 loc) · 860 Bytes
/
core.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
package main
import (
"log"
"os"
"time"
"github.com/CAU-CLINK/blockchain_with_go/common"
"github.com/CAU-CLINK/blockchain_with_go/conf"
"github.com/urfave/cli"
)
func main() {
app := cli.NewApp()
app.Name = "clink-education-chain-core"
app.Version = "0.0.0"
app.Compiled = time.Now()
app.Authors = []cli.Author{
cli.Author{
Name: "KSJ",
Email: "[email protected]",
},
}
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "config, c",
Value: "",
Usage: "name for config",
},
}
app.Commands = []cli.Command{}
app.Before = func(c *cli.Context) error {
if configPath := c.String("config"); configPath != "" {
absPath, err := common.RelativeToAbsolutePath(configPath)
if err != nil {
return err
}
conf.ConfigPath(absPath)
}
return nil
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}