refactor(file-transfer): replace base64 encoding with direct file transfer method in various components for improved clarity and efficiency
This commit is contained in:
@@ -1069,9 +1069,9 @@ function validateComposeFile(string $compose, int $server_id): string|Throwable
|
||||
}
|
||||
}
|
||||
}
|
||||
$base64_compose = base64_encode(Yaml::dump($yaml_compose));
|
||||
$compose_content = Yaml::dump($yaml_compose);
|
||||
transfer_file_to_server($compose_content, "/tmp/{$uuid}.yml", $server);
|
||||
instant_remote_process([
|
||||
"echo {$base64_compose} | base64 -d | tee /tmp/{$uuid}.yml > /dev/null",
|
||||
"chmod 600 /tmp/{$uuid}.yml",
|
||||
"docker compose -f /tmp/{$uuid}.yml config --no-interpolate --no-path-resolution -q",
|
||||
"rm /tmp/{$uuid}.yml",
|
||||
|
@@ -69,12 +69,11 @@ function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase|Appli
|
||||
$fileVolume->content = $content;
|
||||
$fileVolume->is_directory = false;
|
||||
$fileVolume->save();
|
||||
$content = base64_encode($content);
|
||||
$dir = str($fileLocation)->dirname();
|
||||
instant_remote_process([
|
||||
"mkdir -p $dir",
|
||||
"echo '$content' | base64 -d | tee $fileLocation",
|
||||
], $server);
|
||||
transfer_file_to_server($content, $fileLocation, $server);
|
||||
} elseif ($isFile === 'NOK' && $isDir === 'NOK' && $fileVolume->is_directory && $isInit) {
|
||||
// Does not exists (no dir or file), flagged as directory, is init
|
||||
$fileVolume->content = null;
|
||||
|
Reference in New Issue
Block a user