You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
setting config options from cli may break config #740
setting the repo's Log.MaxSizeMB from the cli breaks the config:
> ipfs config Log.MaxSizeMB
0
> ipfs config Log.MaxSizeMB 100
Error: Failed to set config value: Failure to decode config: json: cannot unmarshal string into Go value of type uint64
> ipfs config Log.MaxSizeMB
Error: Failure to decode config: json: cannot unmarshal string into Go value of type uint64
> ipfs config edit
Error: Failure to decode config: json: cannot unmarshal string into Go value of type uint64
One part of this problem is that the config is written to disk before it is validated against the Config struct. (Recall: users are allowed to set keys that don't exist on the struct) This is fixed in #742.
current state
Since '--json' supersedes '--bool', should we get rid of the latter?
Otherwise if '--bool' is kept then '--integer' (this issue) and '--number' (float type) need to exist, for consistency.
The bug (for integer case) itself has been fixed by when setting config keys, validate against struct before writing to disk #742
From the test result, for intuitiveness sake I'd say why not assume the value is json by default and then put escaped quote around numbers when you need them to be string (e.g. the value of Version.CheckPeriod? Why this is string I have no idea).
Activity
fix(repo/config) validate against struct before writing to disk
fix(repo/config) validate against struct before writing to disk
fix(repo/config) validate against struct before writing to disk
btc commentedon Feb 4, 2015
One part of this problem is that the config is written to disk before it is validated against the
Configstruct. (Recall: users are allowed to set keys that don't exist on the struct) This is fixed in #742.[-]setting config options from cli make break config[/-][+]setting config options from cli may break config[/+]jbenet commentedon May 19, 2015
@rht thanks for picking this up.
I've since implemented the
--jsonoption, so maybe we could ask users to use--json. Check it out at:https://github.com/ipfs/go-ipfs/blob/master/core/commands/config.go#L79-L87
not sure, what do you think is most intuitive?
rht commentedon May 19, 2015
Depends on how the config is used. I will check how postfix, vault, etc nail this, and why.
rht commentedon May 19, 2015
Since '--json' supersedes '--bool', should we get rid of the latter?
Otherwise if '--bool' is kept then '--integer' (this issue) and '--number' (float type) need to exist, for consistency.
The bug (for integer case) itself has been fixed by when setting config keys, validate against struct before writing to disk #742
value is always stored as string, see https://github.com/hashicorp/vault/blob/master/helper/kv-builder/builder.go#L74-L107
vault write secret/alice bob={false:true}Will be stored as
{"bob":"{false:true}"}nginx -g "pid /var/run/nginx.pid; worker_processes 2;"postconf -e "postfix_mydestination = localhost"ipfs config atoms/mol 11666->"atoms/mol": 11666ipfs config atoms/mol 11666.66->"atoms/mol": "11666.66"ipfs config --json atoms/mol 11666.66->"atoms/mol": 11666.66ipfs config --json atoms/mol "11666.66"->"atoms/mol": 11666.66ipfs config --json atoms/mol "\"11666.66\""->"atoms/mol": "11666.66"From the test result, for intuitiveness sake I'd say why not assume the value is json by default and then put escaped quote around numbers when you need them to be string (e.g. the value of Version.CheckPeriod? Why this is string I have no idea).
rht commentedon Jul 14, 2015
@jbenet This is fixed.
jbenet commentedon Jul 14, 2015
@rht, that's right, thanks!