File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
src/Compose/ProductionBuilder/Service Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ public function getConfig(Config $config): array
6262 'aliases ' => [$ config ->getHost ()]
6363 ]
6464 ],
65- 'environment ' => [ ' UPSTREAM_HOST ' => $ this ->getBackendService ($ config )] ,
65+ 'environment ' => $ this ->getBackendServiceUpstream ($ config ),
6666 'ports ' => [
6767 $ config ->getPort () . ':80 ' ,
6868 $ config ->getTlsPort () . ':443 '
@@ -100,4 +100,24 @@ private function getBackendService(Config $config): string
100100 ? BuilderInterface::SERVICE_VARNISH
101101 : BuilderInterface::SERVICE_WEB ;
102102 }
103+
104+ /**
105+ * @param Config $config
106+ * @return string[]
107+ * @throws ConfigurationMismatchException
108+ */
109+ private function getBackendServiceUpstream (Config $ config ): array
110+ {
111+ if ($ config ->hasServiceEnabled (ServiceInterface::SERVICE_VARNISH )) {
112+ return [
113+ 'UPSTREAM_HOST= ' . BuilderInterface::SERVICE_VARNISH ,
114+ 'UPSTREAM_PORT=80 '
115+ ];
116+ }
117+
118+ return [
119+ 'UPSTREAM_HOST= ' . BuilderInterface::SERVICE_WEB ,
120+ 'UPSTREAM_PORT=8080 '
121+ ];
122+ }
103123}
You can’t perform that action at this time.
0 commit comments