user46239: My main bitcoin.conf is located in the AppData. Setting the datadir in it or via argument allows me to let the daemon/qt load another bitcoin.conf that is located in the DataDir. I can also change the main bitcoin.conf by setting the conf via argument and I can also specify includeconf in the config to load another config file.
I'd like to know how the priority will be when using all of the above features on conflicting keys as well as if merging is done and if so, how.
For instance: Which of the values will be used if I define its key in the main config as well as in the config at the datadir and even in a config that was included using includeconf? Is it also possible to use includeconf twice or more times to load more than one additional configuration?
What if I use includeconf in the config of the datadir and in the main conf and both files also contain conflicting keys? Will there be any merging at all?

user51948: Firstly, command line arguments always override the config files.
Secondly, if you specify a config file using -conf, the default config file in the datadir will not be used - only the config file you specified will be used.
Thirdly, if you don't specify a -datadir as a command line argument, the bitcoin.conf in the default datadir location will be loaded. If that config file specifies a different datadir be used, that chosen datadir will be used for blocks, wallets, etc. but no config file will be loaded from it. The config file in the chosen datadir will only be used if you load Bitcoin with the -datadir arg set on the command line so that it looks in that datadir first.
Generally, if there is a conflict between two options, the first one will win. That means an option set in the main conf file will take precedence over one set in an includeconf file. You can use multiple includeconf augments in the main config file but they can't be recursive - you can't use includeconf inside a file that was included using includeconf.
The exception to this is that options declared network-specific (e.g. [main]) will take precedence over non-network-specific options, even if declared later.
Source

46239: <p>My main <code>bitcoin.conf</code> is located in the AppData. Setting the <code>datadir</code> in it or via argument allows me to let the daemon/qt load another <code>bitcoin.conf</code> that is located in the DataDir. I can also change the main <code>bitcoin.conf</code> by setting the <code>conf</code> via argument and I can also specify <code>includeconf</code> in the config to load another config file.</p>
<p>I'd like to know how the priority will be when using all of the above features on conflicting keys as well as if merging is done and if so, how.</p>
<p>For instance: Which of the values will be used if I define its key in the main config as well as in the config at the <code>datadir</code> and even in a config that was included using <code>includeconf</code>? Is it also possible to use <code>includeconf</code> twice or more times to load more than one additional configuration?</p>
<p>What if I use <code>includeconf</code> in the config of the <code>datadir</code> and in the main <code>conf</code> and both files also contain conflicting keys? Will there be any merging at all?</p>
 51948: <p>Firstly, command line arguments always override the config files.</p>
<p>Secondly, if you specify a config file using <code>-conf</code>, the default config file in the datadir will not be used - only the config file you specified will be used.</p>
<p>Thirdly, if you don't specify a <code>-datadir</code> as a command line argument, the bitcoin.conf in the default datadir location will be loaded. If that config file specifies a different datadir be used, that chosen datadir will be used for blocks, wallets, etc. but no config file will be loaded from it. The config file in the chosen datadir will only be used if you load Bitcoin with the <code>-datadir</code> arg set on the command line so that it looks in that datadir <em>first</em>.</p>
<p>Generally, if there is a conflict between two options, the first one will win. That means an option set in the main conf file will take precedence over one set in an <code>includeconf</code> file. You can use multiple <code>includeconf</code> augments in the main config file but they can't be recursive - you can't use <code>includeconf</code> inside a file that was included using <code>includeconf</code>.</p>
<p>The exception to this is that options declared network-specific (e.g. <code>[main]</code>) will take precedence over non-network-specific options, even if declared later.</p>
<p><a href="https://github.com/bitcoin/bitcoin/blob/853ac47705c8abd9b8bda2da59eb043d9591491c/doc/bitcoin-conf.md" rel="nofollow noreferrer">Source</a></p>
