fix: $ in env variable

feat: multiline envs
This commit is contained in:
Andras Bacsai
2024-03-14 23:00:06 +01:00
parent a4c164a57e
commit a336dae84c
10 changed files with 66 additions and 12 deletions

View File

@@ -557,7 +557,8 @@ function convert_docker_run_to_compose(?string $custom_docker_run_options = null
return $compose_options->toArray();
}
function validateComposeFile(string $compose, int $server_id): string|Throwable {
function validateComposeFile(string $compose, int $server_id): string|Throwable
{
return 'OK';
try {
$uuid = Str::random(10);
@@ -578,3 +579,10 @@ function validateComposeFile(string $compose, int $server_id): string|Throwable
], $server);
}
}
function escapeEnvVariables($value)
{
$search = array("\\", "\r", "\t", "\x0", '"', "'", "$");
$replace = array("\\\\", "\\r", "\\t", "\\0", '\"', "\'", "$$");
return str_replace($search, $replace, $value);
}