<blockquote>
<p>So which of the following are valid:</p>
</blockquote>
<p>All of them, as the parser does trim whitespace before and after the string, and before and after both the name and value after splitting them.</p>
<blockquote>
<p>However, that brings me to the original question: Where can I find the parser implementation of bitcoin.conf files that Bitcoin Core uses?</p>
</blockquote>
<p>Config file handling can be found in <code>src/util/system.cpp</code>, with the main function being <code>ReadConfigFiles</code>. The options are parsed in <code>GetConfigOptions</code>.</p>

CC BY-SA 4.0
2023-01-09T07:47:29.737Z
Thank you! Very helpful.
Kiminuo
CC BY-SA 4.0
2023-01-08T22:21:23.747Z
2023-01-08T22:21:23.747Z
Ava Chow
<p>I have read <a href="https://github.com/bitcoin/bitcoin/blob/911a40ead256b8849166cff1b745b9c9898e2da8/doc/bitcoin-conf.md" rel="nofollow noreferrer">bitcoin.conf Configuration File</a> which mentions: <em>The configuration file is a plain text file and consists of <code>option=value</code> entries, one per line. Leading and trailing whitespaces are removed.</em></p>
<p>So which of the following are valid:</p>
<ul>
<li><code>option=value</code></li>
<li><code> option=value</code></li>
<li><code> option =value</code></li>
<li><code>option=value</code></li>
<li><code>option = value</code></li>
</ul>
<p>?</p>
<p>I know I can try the above options. However, that brings me to the original question: Where can I find the parser implementation of <code>bitcoin.conf</code> files that Bitcoin Core uses?</p>

<bitcoin-core><bitcoin-core-development><bitcoin.conf>
Where can I find the parser for `bitcoin.conf` files?
Kiminuo
# Where can I find the parser for `bitcoin.conf` files?

(Asked by: username_0 on 2023-01-08)

I have read [bitcoin.conf Configuration File](https://github.com/bitcoin/bitcoin/blob/911a40ead256b8849166cff1b745b9c9898e2da8/doc/bitcoin-conf.md) which mentions: *The configuration file is a plain text file and consists of `option=value` entries, one per line. Leading and trailing whitespaces are removed.*

So which of the following are valid:

* `option=value`
* `option=value`
* `option =value`
* `option=value`
* `option = value`

?

I know I can try the above options. However, that brings me to the original question: Where can I find the parser implementation of `bitcoin.conf` files that Bitcoin Core uses?

**Tags:** bitcoin-core, bitcoin-core-development, bitcoin.conf


---

## 1 answers

### Answer by username_1 on 2023-01-08. Score: 4 | Accepted answer

> So which of the following are valid:

All of them, as the parser does trim whitespace before and after the string, and before and after both the name and value after splitting them.

> However, that brings me to the original question: Where can I find the parser implementation of bitcoin.conf files that Bitcoin Core uses?

Config file handling can be found in `src/util/system.cpp`, with the main function being `ReadConfigFiles`. The options are parsed in `GetConfigOptions`.

> **Comments:**
> **username_0**: Thank you! Very helpful.  

---

