mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Properly escape env vars
This commit is contained in:
1 parent
f768cc937e
commit
c5a62946e9
1 file changed
+17
-1
@@ -181,7 +181,7 @@ class FunctionsV1
|
||||
]);
|
||||
|
||||
\array_walk($vars, function (&$value, $key) {
|
||||
$value = (empty($value)) ? 'null' : $value;
|
||||
$value = \escapeshellarg((empty($value)) ? 'null' : $value);
|
||||
$value = "\t\t\t--env {$key}={$value} \\";
|
||||
});
|
||||
|
||||
@@ -283,6 +283,22 @@ class FunctionsV1
|
||||
|
||||
$executionEnd = \microtime(true);
|
||||
|
||||
var_dump("docker run \
|
||||
-d \
|
||||
--entrypoint=\"\" \
|
||||
--cpus=4 \
|
||||
--memory=128m \
|
||||
--memory-swap=128m \
|
||||
--rm \
|
||||
--name={$container} \
|
||||
--label appwrite-type=function \
|
||||
--label appwrite-created=".\time()." \
|
||||
--volume {$tagPathTargetDir}:/tmp:rw \
|
||||
--workdir /usr/local/src \
|
||||
".\implode("\n", $vars)."
|
||||
{$environment['image']} \
|
||||
sh -c 'mv /tmp/code.tar.gz /usr/local/src/code.tar.gz && tar -zxf /usr/local/src/code.tar.gz --strip 1 && rm /usr/local/src/code.tar.gz && tail -f /dev/null'");
|
||||
|
||||
if($exitCode !== 0) {
|
||||
throw new Exception('Failed to create function environment: '.$stderr);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user