chore: Refactor code to improve SSH key handling and storage

This commit is contained in:
Andras Bacsai
2024-09-29 20:12:30 +02:00
parent 795af8de52
commit cccd05f322
3 changed files with 3 additions and 12 deletions

View File

@@ -1236,8 +1236,6 @@ function parseLineForSudo(string $command, Server $server): string
function get_public_ips()
{
try {
echo "Refreshing public ips!\n";
$settings = \App\Models\InstanceSettings::get();
[$first, $second] = Process::concurrently(function (Pool $pool) {
$pool->path(__DIR__)->command('curl -4s https://ifconfig.io');
$pool->path(__DIR__)->command('curl -6s https://ifconfig.io');
@@ -1251,7 +1249,7 @@ function get_public_ips()
return;
}
$settings->update(['public_ipv4' => $ipv4]);
InstanceSettings::get()->update(['public_ipv4' => $ipv4]);
}
} catch (\Exception $e) {
echo "Error: {$e->getMessage()}\n";
@@ -1266,7 +1264,7 @@ function get_public_ips()
return;
}
$settings->update(['public_ipv6' => $ipv6]);
InstanceSettings::get()->update(['public_ipv6' => $ipv6]);
}
} catch (\Throwable $e) {
echo "Error: {$e->getMessage()}\n";