lotus/daemon/cmd.go

40 lines
694 B
Go
Raw Normal View History

2019-07-09 13:15:37 +00:00
// +build !nodaemon
package daemon
import (
2019-07-02 12:40:25 +00:00
"context"
2019-07-05 10:06:28 +00:00
"github.com/filecoin-project/go-lotus/node"
2019-07-04 15:50:48 +00:00
"github.com/filecoin-project/go-lotus/node/config"
"gopkg.in/urfave/cli.v2"
)
2019-07-02 13:05:43 +00:00
// Cmd is the `go-lotus daemon` command
var Cmd = &cli.Command{
Name: "daemon",
Usage: "Start a lotus daemon process",
2019-07-08 20:50:13 +00:00
Flags: []cli.Flag{
&cli.StringFlag{
Name: "api",
Value: ":1234",
},
},
2019-07-02 12:40:25 +00:00
Action: func(cctx *cli.Context) error {
ctx := context.Background()
2019-07-04 15:50:48 +00:00
cfg, err := config.FromFile("./config.toml")
if err != nil {
return err
}
api, err := node.New(ctx, node.Online(), node.Config(cfg))
if err != nil {
return err
}
2019-07-08 20:50:13 +00:00
return serveRPC(api, cctx.String("api"))
},
}