|
7 | 7 |
|
8 | 8 | namespace Magento\CloudDocker\Compose; |
9 | 9 |
|
| 10 | +use Magento\CloudDocker\App\ConfigurationMismatchException; |
| 11 | +use Magento\CloudDocker\Compose\ProductionBuilder\ServiceBuilderInterface; |
10 | 12 | use Magento\CloudDocker\Compose\ProductionBuilder\ServicePool; |
11 | 13 | use Magento\CloudDocker\Compose\ProductionBuilder\VolumeResolver; |
12 | 14 | use Magento\CloudDocker\Config\Config; |
@@ -35,7 +37,6 @@ class ProductionBuilder implements BuilderInterface |
35 | 37 | self::SERVICE_GENERIC, |
36 | 38 | self::SERVICE_DEPLOY, |
37 | 39 | self::SERVICE_BUILD, |
38 | | - self::SERVICE_TLS, |
39 | 40 | self::SERVICE_WEB, |
40 | 41 | self::SERVICE_FPM, |
41 | 42 | self::SERVICE_DB, |
@@ -91,7 +92,7 @@ public function build(Config $config): Manager |
91 | 92 | $manager = $this->managerFactory->create($config); |
92 | 93 |
|
93 | 94 | foreach ($this->servicePool->getServices() as $service) { |
94 | | - if ($config->hasServiceEnabled($service->getServiceName()) |
| 95 | + if ($this->hasServiceEnabled($service, $config) |
95 | 96 | || in_array($service->getName(), self::$requiredServices) |
96 | 97 | ) { |
97 | 98 | $manager->addService($service); |
@@ -135,4 +136,24 @@ public function getPath(): string |
135 | 136 | { |
136 | 137 | return $this->fileList->getMagentoDockerCompose(); |
137 | 138 | } |
| 139 | + |
| 140 | + /** |
| 141 | + * Checks the availability of the service |
| 142 | + * |
| 143 | + * @param ServiceBuilderInterface $service |
| 144 | + * @param Config $config |
| 145 | + * @return bool |
| 146 | + * @throws ConfigurationMismatchException |
| 147 | + */ |
| 148 | + private function hasServiceEnabled(ServiceBuilderInterface $service, Config $config): bool |
| 149 | + { |
| 150 | + $serviceNames = [ |
| 151 | + BuilderInterface::SERVICE_FPM_XDEBUG, |
| 152 | + BuilderInterface::SERVICE_DB_QUOTE, |
| 153 | + BuilderInterface::SERVICE_DB_SALES, |
| 154 | + ]; |
| 155 | + $service = in_array($service->getName(), $serviceNames) ? $service->getServiceName() : $service->getName(); |
| 156 | + |
| 157 | + return $config->hasServiceEnabled($service); |
| 158 | + } |
138 | 159 | } |
0 commit comments