filecoin-project / dealbot

🤖🤝 A bot for making deals
Apache License 2.0
32 stars 10 forks source link

How to start controller with specified config file? #360

Closed kuchaguangjie closed 2 years ago

kuchaguangjie commented 2 years ago

I've installed dealbot (built with git tag v0.0.40). and downloaded dealbot-example.toml, and renamed to dealbot.tom, and changed its data dirs, and created those dirs.


Then when run according to README file: dealbot controller --configpath ~/dealbot.toml or dealbot daemon --configpath dealbot.toml

both and got error:

FATAL dealbot dealbot/main.go:94 flag provided but not defined: -configpath


Then checked dealbot -h for help, and tried: dealbot -c ~/dealbot.toml controller
and got error:

FATAL dealbot dealbot/main.go:94 Unable to create input source with context: inner error: 'Unable to load Yaml file '/home/eric/dealbot.toml': inner error: 'yaml: unmarshal errors: line 1: cannot unmarshal !!seq into map[interface {}]interface {}'


content of dealbot.toml:

[controller]
listen = "localhost:8764"

[daemon]
listen        = "localhost:0"
data_dir      = "/mnt/star/data/filecoin/dealbot/dealbot"
node_data_dir = "/mnt/star/data/filecoin/dealbot/dealbot"
api           = "token:/ip4/127.0.0.1/tcp/1234/http"
wallet        = ""
workers       = 4

[client]
endpoint = "http://localhost:8764"

So, is the README.md out of date? Any help? Thanks.

willscott commented 2 years ago

The config file is one way, env vars are another, or passing directly in on command line are a third.

kuchaguangjie commented 2 years ago

@willscott Thanks.


Regarding first issue, you mean I should use -c instead of --configpath? I've tried 4 commands:

dealbot controller --configpath ~/dealbot.toml
dealbot --configpath ~/dealbot.toml controller

dealbot controller -c ~/dealbot.toml
dealbot -c ~/dealbot.toml controller

Only the last one can recognize the -c param


About the second issue, you mean all flags from https://github.com/filecoin-project/dealbot/blob/main/commands/flags.go#L229 are required?

Is there a working dealbot .toml example? Or a working env file example, or a command line example ?

Thanks.

willscott commented 2 years ago

either

dealbot -c ~/dealbot.toml controller

or

dealbot -configpath ~/dealbot.toml controller

we run the controller through a kubernetes / helm setup. The env var setup we use is here

kuchaguangjie commented 2 years ago

@willscott Thanks, I've check the source code & tried, and get below result:

Regarding the first issue, it seems only -c and --config works.

Regarding the second issue, toml is not supported anymore, though yaml is supported. And I succeed to start controller via purely command line flags without config file.

kuchaguangjie commented 2 years ago

So, the README file is quite out of date, maybe it need an update.