private function buildConfig()
    {
        $env = getenv('CRM_ENV');

        $configData = [
            'paths' => [
                'migrations' => [
                    '%%PHINX_CONFIG_DIR%%/../../../../migrations'
                ]
            ],
            'environments' => [
                'default_migration_table' => 'phinxlog',
                'default_database' => $env,
            ],
        ];

        foreach ($this->moduleManager->getModules() as $module) {
            $reflector = new \ReflectionClass($module);
            $configData['paths']['migrations'][] = dirname($reflector->getFileName()) . '/migrations';
        }

        $configData['environments'][$env] = [
            'adapter' => $this->envConfig->get('CRM_DB_ADAPTER'),
            'host' => $this->envConfig->get('CRM_DB_HOST'),
            'name' => $this->envConfig->get('CRM_DB_NAME'),
            'user' => $this->envConfig->get('CRM_DB_USER'),
            'pass' => $this->envConfig->get('CRM_DB_PASS'),
            'port' => $this->envConfig->get('CRM_DB_PORT'),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
        ];

        return $configData;
    }