lotus/cmd/lotus-storage-miner/main.go

77 lines
1.5 KiB
Go
Raw Normal View History

2019-07-18 23:16:23 +00:00
package main
import (
"os"
logging "github.com/ipfs/go-log"
"go.opencensus.io/trace"
2019-07-18 23:16:23 +00:00
"gopkg.in/urfave/cli.v2"
"github.com/filecoin-project/lotus/build"
lcli "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/tracing"
2019-07-18 23:16:23 +00:00
)
var log = logging.Logger("main")
2019-07-23 21:50:52 +00:00
const FlagStorageRepo = "storagerepo"
2019-07-18 23:16:23 +00:00
func main() {
logging.SetLogLevel("*", "INFO")
2019-10-29 19:51:44 +00:00
logging.SetLogLevel("swarm", "WARN")
2019-07-18 23:16:23 +00:00
local := []*cli.Command{
runCmd,
initCmd,
2019-10-11 23:47:29 +00:00
infoCmd,
pledgeSectorCmd,
sectorsCmd,
2019-07-18 23:16:23 +00:00
}
jaeger := tracing.SetupJaegerTracing("lotus")
defer func() {
if jaeger != nil {
jaeger.Flush()
}
}()
for _, cmd := range local {
cmd := cmd
originBefore := cmd.Before
cmd.Before = func(cctx *cli.Context) error {
trace.UnregisterExporter(jaeger)
jaeger = tracing.SetupJaegerTracing("lotus/" + cmd.Name)
if originBefore != nil {
return originBefore(cctx)
}
return nil
}
}
2019-07-18 23:16:23 +00:00
app := &cli.App{
Name: "lotus-storage-miner",
Usage: "Filecoin decentralized storage network storage miner",
Version: build.Version,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
EnvVars: []string{"LOTUS_PATH"},
Hidden: true,
Value: "~/.lotus", // TODO: Consider XDG_DATA_HOME
},
&cli.StringFlag{
2019-07-23 21:50:52 +00:00
Name: FlagStorageRepo,
EnvVars: []string{"LOTUS_STORAGE_PATH"},
2019-07-18 23:16:23 +00:00
Value: "~/.lotusstorage", // TODO: Consider XDG_DATA_HOME
},
},
Commands: append(local, lcli.Commands...),
}
if err := app.Run(os.Args); err != nil {
2019-11-27 11:57:52 +00:00
log.Warnf("%+v", err)
2019-11-12 23:36:49 +00:00
os.Exit(1)
2019-07-18 23:16:23 +00:00
}
}