Remove redundant enabled flag from VCS provider registry

Presence in the registry already means "supported" -- a separate enabled
flag that every real entry hardcodes to true adds nothing. To disable a
provider, remove its entry instead.
This commit is contained in:
harsh mahajan committed 2026-07-14 18:45:01 +05:30
1 parent 7b08377a90
commit 01064bace5
3 files changed
+1 -24

No files matched your search

-2
View File
@@ -9,7 +9,6 @@ use Utopia\VCS\Adapter\Git\GitHub;
return [
'github' => [
'enabled' => true,
'adapter' => GitHub::class,
'envVariables' => [
'APP_NAME' => '_APP_VCS_GITHUB_APP_NAME',
@@ -22,7 +21,6 @@ return [
'requiredEnvVariables' => ['APP_NAME', 'PRIVATE_KEY', 'APP_ID', 'CLIENT_ID', 'CLIENT_SECRET'],
],
'gitea' => [
'enabled' => true,
'adapter' => Gitea::class,
'envVariables' => [
'ENDPOINT' => '_APP_VCS_GITEA_ENDPOINT',
+1 -9
View File
@@ -23,15 +23,7 @@ class Factory
protected Cache $cache,
?array $registry = null,
) {
$registry ??= Config::getParam('vcs', []);
foreach ($registry as $key => $entry) {
if (!($entry['enabled'] ?? false)) {
continue;
}
$this->registry[$key] = $entry;
}
$this->registry = $registry ?? Config::getParam('vcs', []);
}
public function getProviders(): array
-13
View File
@@ -35,17 +35,6 @@ final class FactoryTest extends TestCase
}
}
public function testDisabledProvidersAreNotRegistered(): void
{
$factory = new Factory($this->cache(), [
'github' => $this->githubEntry(),
'legacy' => ['enabled' => false] + $this->githubEntry(),
]);
$this->expectException(Exception::class);
$factory->fromProvider('legacy');
}
public function testFromProviderUnknownThrows(): void
{
$factory = new Factory($this->cache(), ['github' => $this->githubEntry()]);
@@ -84,7 +73,6 @@ final class FactoryTest extends TestCase
public function testIsConfigured(): void
{
$entry = [
'enabled' => true,
'adapter' => GitHub::class,
'envVariables' => ['TOKEN' => '_APP_VCS_TEST_TOKEN'],
'requiredEnvVariables' => ['TOKEN'],
@@ -122,7 +110,6 @@ final class FactoryTest extends TestCase
protected function githubEntry(): array
{
return [
'enabled' => true,
'adapter' => GitHub::class,
'envVariables' => [
'APP_NAME' => '_APP_VCS_GITHUB_APP_NAME',