Skip to content

Commit

Permalink
Merge pull request #299 from php-school/configurable-process-factory
Browse files Browse the repository at this point in the history
Allow to configure process factory
  • Loading branch information
AydinHassan authored May 17, 2024
2 parents 98507c0 + 65049c5 commit 18de201
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
use PhpSchool\PhpWorkshop\Output\OutputInterface;
use PhpSchool\PhpWorkshop\Output\StdOutput;
use PhpSchool\PhpWorkshop\Patch;
use PhpSchool\PhpWorkshop\Process\DockerProcessFactory;
use PhpSchool\PhpWorkshop\Process\HostProcessFactory;
use PhpSchool\PhpWorkshop\Process\ProcessFactory;
use PhpSchool\PhpWorkshop\Result\Cgi\CgiResult;
Expand Down Expand Up @@ -208,7 +209,16 @@
},

ProcessFactory::class => function (ContainerInterface $c) {
return new HostProcessFactory();
$processFactory = $_ENV['process_factory'] ?? null;

return match ($processFactory) {
'docker' => new DockerProcessFactory(
$c->get('basePath'),
$c->get('appName'),
$c->get('phpschoolGlobalDir') . '/composer-cache',
),
default => new HostProcessFactory(),
};
},

//commands
Expand Down

0 comments on commit 18de201

Please sign in to comment.