mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
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:
1 parent
7b08377a90
commit
01064bace5
3 files changed
+1
-24
No files matched your search
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in new issue
Block a user