refactor(file-transfer): replace base64 encoding with direct file transfer method across multiple database actions for improved clarity and efficiency

This commit is contained in:
Andras Bacsai
2025-09-08 14:04:24 +02:00
parent 852b2688d9
commit 18068857b1
17 changed files with 298 additions and 107 deletions

View File

@@ -1082,7 +1082,6 @@ $schema://$host {
public function validateConnection(bool $justCheckingNewKey = false)
{
ray('validateConnection', $this->id);
$this->disableSshMux();
if ($this->skipServer()) {
@@ -1320,7 +1319,6 @@ $schema://$host {
public function generateCaCertificate()
{
try {
ray('Generating CA certificate for server', $this->id);
SslHelper::generateSslCertificate(
commonName: 'Coolify CA Certificate',
serverId: $this->id,
@@ -1328,7 +1326,6 @@ $schema://$host {
validityDays: 10 * 365
);
$caCertificate = SslCertificate::where('server_id', $this->id)->where('is_ca_certificate', true)->first();
ray('CA certificate generated', $caCertificate);
if ($caCertificate) {
$certificateContent = $caCertificate->ssl_certificate;
$caCertPath = config('constants.coolify.base_config_path').'/ssl/';

View File

@@ -1281,8 +1281,10 @@ class Service extends BaseModel
if ($envs->count() === 0) {
$commands[] = 'touch .env';
} else {
$envs_base64 = base64_encode($envs->implode("\n"));
$commands[] = "echo '$envs_base64' | base64 -d | tee .env > /dev/null";
$envs_content = $envs->implode("\n");
transfer_file_to_server($envs_content, $this->workdir().'/.env', $this->server);
return;
}
instant_remote_process($commands, $this->server);