Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: config must be a boolean. #561

Closed
BluSyn opened this issue Aug 8, 2018 · 2 comments · Fixed by #563
Closed

Error: config must be a boolean. #561

BluSyn opened this issue Aug 8, 2018 · 2 comments · Fixed by #563

Comments

@BluSyn
Copy link
Collaborator

BluSyn commented Aug 8, 2018

Caused by #535 merged on latest master.

Previously you could specify a custom config path for node using --config or BCOIN_CONFIG env.
Example: bcoin --config /secrets/bcoin.conf

This now causes bcoin to crash with: Error: config must be a boolean.

config option is used in two different places.

  1. node: https://github.com/bcoin-org/bcoin/blob/master/lib/node/node.js#L46
  2. wallet: https://github.com/bcoin-org/bcoin/blob/master/lib/wallet/plugin.js#L38

I see two solutions.

  1. change node.config.bool('config') to this.config.bool('config'), which would allow disabling config using --wallet-config false CLI option. However this would preclude the ability to set a custom wallet config path like you can this node. Though this is currently unsupported, I think we should add this ability to make wallet options consistent with node options.
  2. Change param to something more explicit such as: wallet-disable-config: true (!this.config.bool('disable-config'))
@BluSyn
Copy link
Collaborator Author

BluSyn commented Aug 8, 2018

The actual relevant collision is in bcfg:
https://github.com/bcoin-org/bcfg/blob/master/lib/config.js#L752
So this does support --wallet-config option currently.

The desired behavior seems to want this as an option passed to wallet constructor, but because it's a plugin it doesn't have this same initialization as FullNode does.

Simplest solution is to have wallet-disable-config or similar passed in node config. Alternatively tests that have this issue could just specify a different file using wallet-config, by-passing the need for this logic at all.

@tuxcanfly
Copy link
Member

@BluSyn Yeah, I think the core issue here is that the config key clashes with the internal key used by bcfg for storing the config file path.

I tried another approach by using a different key to indicate whether or not to load the file, (file, consistent with other keys such as argv, env) and I was able to avoid the clash.

https://gist.github.com/tuxcanfly/8c09aea8c55c0db77f64a48bfd077039

Although the issue with passing down options to plugins still exists , this could be a simple fix until the issue is fixed in bcfg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants