Address review
This commit is contained in:
parent
677f5c3e30
commit
4f1946d5a2
@ -16,13 +16,13 @@ var initCmd = &cli.Command{
|
|||||||
log.Info("Initializing lotus storage miner")
|
log.Info("Initializing lotus storage miner")
|
||||||
log.Info("Checking if repo exists")
|
log.Info("Checking if repo exists")
|
||||||
|
|
||||||
r, err := repo.NewFS(cctx.String("storagerepo"))
|
r, err := repo.NewFS(cctx.String(FlagStorageRepo))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.Exists() {
|
if r.Exists() {
|
||||||
return xerrors.Errorf("repo at '%s' is already initialized", cctx.String("storagerepo"))
|
return xerrors.Errorf("repo at '%s' is already initialized", cctx.String(FlagStorageRepo))
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Trying to connect to full node RPC")
|
log.Info("Trying to connect to full node RPC")
|
||||||
|
@ -12,6 +12,8 @@ import (
|
|||||||
|
|
||||||
var log = logging.Logger("main")
|
var log = logging.Logger("main")
|
||||||
|
|
||||||
|
const FlagStorageRepo = "storagerepo"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
logging.SetLogLevel("*", "INFO")
|
logging.SetLogLevel("*", "INFO")
|
||||||
local := []*cli.Command{
|
local := []*cli.Command{
|
||||||
@ -31,9 +33,8 @@ func main() {
|
|||||||
Value: "~/.lotus", // TODO: Consider XDG_DATA_HOME
|
Value: "~/.lotus", // TODO: Consider XDG_DATA_HOME
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "storagerepo",
|
Name: FlagStorageRepo,
|
||||||
EnvVars: []string{"LOTUS_STORAGE_PATH"},
|
EnvVars: []string{"LOTUS_STORAGE_PATH"},
|
||||||
Hidden: true,
|
|
||||||
Value: "~/.lotusstorage", // TODO: Consider XDG_DATA_HOME
|
Value: "~/.lotusstorage", // TODO: Consider XDG_DATA_HOME
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -17,11 +17,6 @@ var runCmd = &cli.Command{
|
|||||||
Name: "run",
|
Name: "run",
|
||||||
Usage: "Start a lotus storage miner process",
|
Usage: "Start a lotus storage miner process",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "storagerepo",
|
|
||||||
EnvVars: []string{"LOTUS_STORAGE_PATH"},
|
|
||||||
Value: "~/.lotusstorage", // TODO: Consider XDG_DATA_HOME
|
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "api",
|
Name: "api",
|
||||||
Value: "2345",
|
Value: "2345",
|
||||||
@ -36,13 +31,13 @@ var runCmd = &cli.Command{
|
|||||||
|
|
||||||
v, err := api.Version(ctx)
|
v, err := api.Version(ctx)
|
||||||
|
|
||||||
r, err := repo.NewFS(cctx.String("storagerepo"))
|
r, err := repo.NewFS(cctx.String(FlagStorageRepo))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !r.Exists() {
|
if !r.Exists() {
|
||||||
return xerrors.Errorf("repo at '%s' is not initialized, run 'lotus-storage-miner init' to set it up", cctx.String("storagerepo"))
|
return xerrors.Errorf("repo at '%s' is not initialized, run 'lotus-storage-miner init' to set it up", cctx.String(FlagStorageRepo))
|
||||||
}
|
}
|
||||||
|
|
||||||
minerapi, err := node.New(ctx,
|
minerapi, err := node.New(ctx,
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// DaemonCmd is the `go-lotus daemon` command
|
// DaemonCmd is the `go-lotus daemon` command
|
||||||
var Cmd = &cli.Command{
|
var DaemonCmd = &cli.Command{
|
||||||
Name: "daemon",
|
Name: "daemon",
|
||||||
Usage: "Start a lotus daemon process",
|
Usage: "Start a lotus daemon process",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
|
Loading…
Reference in New Issue
Block a user