Skip to content

Commit 7500d93

Browse files
authored
fix: forked process environment variables issue
1 parent 88c2e30 commit 7500d93

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Thumbnail/FormatThumbnail.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ public function generatePublicUrl(MediaProviderInterface $provider, $media, stri
6161
*/
6262
public function generatePrivateUrl(MediaProviderInterface $provider, MediaInterface $media, string $format)
6363
{
64-
$id = $media instanceof MediaInterface ? $media->getId() : $media['id'];
65-
return sprintf('%s/thumb_%s_%s.%s', $provider->generatePath($media), $id, $format, $this->getExtension($media));
64+
return sprintf('%s/thumb_%s_%s.%s', $provider->generatePath($media), $media->getId(), $format, $this->getExtension($media));
6665
}
6766

6867
/**
@@ -109,7 +108,16 @@ private function forkProcess(MediaInterface $media, string $shortFormat, bool $w
109108
$media->getId(),
110109
$shortFormat
111110
]);
112-
$process->run();
111+
112+
// Pass the AWS environment variables as the forked process does not get them
113+
// This is an issue for ECS
114+
$envVars = [];
115+
foreach (getenv() as $key => $value) {
116+
if (false !== strpos($key, 'AWS_')) {
117+
$envVars[$key] = $value;
118+
}
119+
}
120+
$process->run(null, $envVars);
113121
if ($wait) {
114122
$process->wait();
115123
}

0 commit comments

Comments
 (0)