protected function bootstrapConfig(array $config = null): void
    {
        $cacheFilePath = Directory::cachePath('config.php');

        // If we should use the config cache file
        if (is_file($cacheFilePath)) {
            // Get the config from the cache file's contents
            self::$config = require $cacheFilePath;

            return;
        }

        $config         = $config ?? [];
        $configFilePath = Directory::configPath('config.php');
        $configFilePath = is_file($configFilePath)
            ? $configFilePath
            : __DIR__ . '/Config/config.php';
        $defaultConfigs = require $configFilePath;

        self::$config = array_replace_recursive($defaultConfigs, $config);
        /** @var \Valkyrja\Support\Providers\Provider[] $providers */
        $providers = self::$config['providers'];

        foreach ($providers as $provider) {
            // Config providers are NOT deferred and will not follow the
            // deferred value
            $provider::publish($this);
        }
    }