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
62
62
'aliases ' => [$ config ->getHost ()]
63
63
]
64
64
],
65
- 'environment ' => [ ' UPSTREAM_HOST ' => $ this ->getBackendService ($ config )] ,
65
+ 'environment ' => $ this ->getBackendServiceUpstream ($ config ),
66
66
'ports ' => [
67
67
$ config ->getPort () . ':80 ' ,
68
68
$ config ->getTlsPort () . ':443 '
@@ -100,4 +100,24 @@ private function getBackendService(Config $config): string
100
100
? BuilderInterface::SERVICE_VARNISH
101
101
: BuilderInterface::SERVICE_WEB ;
102
102
}
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
+ }
103
123
}
You can’t perform that action at this time.
0 commit comments