原始文献 / 论坛帖 / Re: JSON-RPC password
Re: JSON-RPC password
Bitcointalk · 2010-07-21 16:07:57 UTC
引用自:gavinandresen 于 July 21, 2010, 12:11:10 PM(https://bitcointalk.org/index.php?topic=461.msg4709#msg4709)
我刚才快速调查了我的 debian 系统 /etc 下的 20 个 .conf 文件,发现:
1 个文件用 "key value"
5 个用 "key=value"
谢谢你的调查!
我觉得 "key value" 有点别扭。键和值之间应该有个更明确的分隔符,暗示这是赋值。用 split 函数的人可能只是图省事。
key=some full sentence with spaces in it. # 这样更清楚
key some full sentence with spaces in it. # 比这样好
好,那就用自解析的 mapConfig,语法:
# comment
key=value
文件扩展名 .conf。文件名是什么,~/.bitcoin/settings.conf 还是 ~/.bitcoin/bitcoin.conf 还是别的?
我觉得键和值首尾的空白最好去掉。
# user who likes column formatted
k = value
key = value
longerkey = this sentence would be this # "this sentence would be this"
key = value # guess this is ok too
nextkey = value
right = justified
正常语法应该是 "key=value",但偶尔有人写成 "key = value" 也不能怪人家。
英文原文
Quote from: gavinandresen on July 21, 2010, 12:11:10 PM(https://bitcointalk.org/index.php?topic=461.msg4709#msg4709)
I just did a quick survey of 20 .conf files in /etc on my debian system, and found:
1 file used "key value"
5 used "key=value"
Thanks for that survey!
I find "key value" a little unnatural. There ought to be a more definite separator between key and value that suggests assignment. The space people may just be getting lazy using their language's split function.
key=some full sentence with spaces in it. # seems more clear
key some full sentence with spaces in it. # than this
Allright then, lets go with self-parsed mapConfig, syntax:
# comment
key=value
file extension .conf. What's the filename, is it ~/.bitcoin/settings.conf or ~/.bitcoin/bitcoin.conf or what?
I think we better strip whitespace at the beginning and end of the key and the value.
# user who likes column formatted
k = value
key = value
longerkey = this sentence would be this # "this sentence would be this"
key = value # guess this is ok too
nextkey = value
right = justified
The normal syntax should be "key=value", but you can't blame people for the occasional "key = value".
