How to load entries data in the General Configuration file? I'm trying to set dynamic paths for values such as activateAccountSuccessPath.

This kind of code below from my routes.php file works very well:

use craft\elements\Entry;

$myAccount = Entry::find()-&gt;section('myAccount');

return [
    $myAccount-&gt;type('user')-&gt;one()-&gt;uri . '/&lt;id&gt;-&lt;slug&gt;' =&gt; ['template' =&gt; '_myAccount/user']
];


But it seems that craft\elements\Entry can't be used at the top of general.php (which make sense...).

Any idea of a simple workaround to load Entry data at this time? Like this, I could set dynamic paths depending of the context and language.

I know I could already set paths like this:

'activateAccountSuccessPath' =&gt; array(
     'fr' =&gt; 'mon-compte',
     'nl' =&gt; 'mijn-account'
),


But this is not enough, I would like the path match dynamically another existing URI in a Structure.
When you take a look at the Docs you'll see


  See craft\helpers\ConfigHelper::localizedValue() for a list of supported value types.


And that contains


  
  $value (mixed) – The config setting value. This can be specified in one of the following forms:
  A scalar value or null: represents the desired value directly, and will be returned verbatim.
  An associative array: represents the desired values across all sites, indexed by site handles. If a matching site handle isn’t listed, the first value will be returned.
  A PHP callable: either an anonymous function or an array representing a class method ([$class or $object, $method]). The callable will be passed the site handle if known, and should return the desired config value.
  $siteHandle (string, null) – The site handle the value should be defined for. Defaults to the current site.
  Returns
  


The interesting thing is a function

'activateAccountSuccessPath' =&gt; function(){
    return Entry::find()-&gt;section('myAccount')..... // do your thing
}