9f9dc979fb
* sptool: Initial structure * sptool: Port lotus-miner actor withdraw * sptool: Make cli docsgen happy * actors are done * info * proving * sptool the rest * fixed gitignore * lints * oops * 2 * terminate * fixes * curio new-miner setup * reword doc section * fix curio flags * fix gen * change repetitive prompt * add miner to base * add config test * fix config compare, add tests * go mod tidy * fix itest in GA * fix comparer function * fix compare value match --------- Co-authored-by: Łukasz Magiera <magik6k@gmail.com> Co-authored-by: Andrew Jackson (Ajax) <snadrus@gmail.com>
58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
"golang.org/x/xerrors"
|
|
|
|
"github.com/filecoin-project/lotus/api"
|
|
cliutil "github.com/filecoin-project/lotus/cli/util"
|
|
"github.com/filecoin-project/lotus/cmd/curio/deps"
|
|
"github.com/filecoin-project/lotus/node/repo"
|
|
)
|
|
|
|
var configNewCmd = &cli.Command{
|
|
Name: "new-cluster",
|
|
Usage: "Create new configuration for a new cluster",
|
|
ArgsUsage: "[SP actor address...]",
|
|
Flags: []cli.Flag{
|
|
&cli.StringFlag{
|
|
Name: "repo",
|
|
EnvVars: []string{"LOTUS_PATH"},
|
|
Hidden: true,
|
|
Value: "~/.lotus",
|
|
},
|
|
},
|
|
Action: func(cctx *cli.Context) error {
|
|
if cctx.Args().Len() < 1 {
|
|
return xerrors.New("must specify at least one SP actor address. Use 'lotus-shed miner create' or use 'curio guided-setup'")
|
|
}
|
|
|
|
ctx := cctx.Context
|
|
|
|
db, err := deps.MakeDB(cctx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
full, closer, err := cliutil.GetFullNodeAPIV1(cctx)
|
|
if err != nil {
|
|
return xerrors.Errorf("connecting to full node: %w", err)
|
|
}
|
|
defer closer()
|
|
|
|
ainfo, err := cliutil.GetAPIInfo(cctx, repo.FullNode)
|
|
if err != nil {
|
|
return xerrors.Errorf("could not get API info for FullNode: %w", err)
|
|
}
|
|
|
|
token, err := full.AuthNew(ctx, api.AllPermissions)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return deps.CreateMinerConfig(ctx, full, db, cctx.Args().Slice(), fmt.Sprintf("%s:%s", string(token), ainfo.Addr))
|
|
},
|
|
}
|