show public key of generated private key

This commit is contained in:
Andras Bacsai
2023-08-27 15:23:47 +02:00
parent 9f10cb2899
commit c21ce45d70
24 changed files with 40 additions and 33 deletions

View File

@@ -14,14 +14,14 @@ class CheckResaleLicense
$settings->update([
'is_resale_license_active' => false,
]);
if (is_dev()) {
if (isDev()) {
return;
}
if (!$settings->resale_license) {
return;
}
$base_url = config('coolify.license_url');
if (is_dev()) {
if (isDev()) {
$base_url = 'http://host.docker.internal:8787';
}
$instance_id = config('app.id');

View File

@@ -12,7 +12,7 @@ class InstallDocker
{
$dockerVersion = '23.0';
$config = base64_encode('{ "live-restore": true }');
if (is_dev()) {
if (isDev()) {
$activity = remote_process([
"echo ####### Installing Prerequisites...",
"echo ####### Installing/updating Docker Engine...",

View File

@@ -50,7 +50,7 @@ class UpdateCoolify
private function update()
{
if (is_dev()) {
if (isDev()) {
ray("Running update on local docker container. Updating to $this->latest_version");
remote_process([
"sleep 10"

View File

@@ -18,7 +18,7 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule): void
{
// $schedule->call(fn() => $this->check_scheduled_backups($schedule))->everyTenSeconds();
if (is_dev()) {
if (isDev()) {
$schedule->command('horizon:snapshot')->everyMinute();
$schedule->job(new ResourceStatusJob)->everyMinute();
$schedule->job(new ProxyCheckJob)->everyFiveMinutes();

View File

@@ -45,7 +45,7 @@ class Handler extends ExceptionHandler
{
$this->reportable(function (Throwable $e) {
$this->settings = InstanceSettings::get();
if ($this->settings->do_not_track || is_dev()) {
if ($this->settings->do_not_track || isDev()) {
return;
}
Integration::captureUnhandledException($e);

View File

@@ -66,7 +66,7 @@ class Controller extends BaseController
]);
}
public function boarding() {
if (currentTeam()->boarding || is_dev()) {
if (currentTeam()->boarding || isDev()) {
return view('boarding');
} else {
return redirect()->route('dashboard');

View File

@@ -14,6 +14,7 @@ class Boarding extends Component
public ?string $privateKeyType = null;
public ?string $privateKey = null;
public ?string $publicKey = null;
public ?string $privateKeyName = null;
public ?string $privateKeyDescription = null;
public ?PrivateKey $createdPrivateKey = null;
@@ -31,7 +32,7 @@ class Boarding extends Component
{
$this->privateKeyName = generate_random_name();
$this->remoteServerName = generate_random_name();
if (is_dev()) {
if (isDev()) {
$this->privateKey = '-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACBbhpqHhqv6aI67Mj9abM3DVbmcfYhZAhC7ca4d9UCevAAAAJi/QySHv0Mk
@@ -77,6 +78,9 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
public function setPrivateKey(string $type)
{
$this->privateKeyType = $type;
if ($type === 'create' && !isDev()) {
$this->createNewPrivateKey();
}
$this->currentState = 'create-private-key';
}
public function savePrivateKey()
@@ -95,9 +99,6 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
'remoteServerPort' => 'required',
'remoteServerUser' => 'required',
]);
if ($this->privateKeyType === 'create') {
$this->createNewPrivateKey();
}
$this->privateKey = formatPrivateKey($this->privateKey);
$this->createdPrivateKey = PrivateKey::create([
'name' => $this->privateKeyName,
@@ -175,6 +176,6 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
{
$this->privateKeyName = generate_random_name();
$this->privateKeyDescription = 'Created by Coolify';
['private' => $this->privateKey] = generateSSHKey();
['private' => $this->privateKey, 'public'=> $this->publicKey] = generateSSHKey();
}
}

View File

@@ -50,7 +50,7 @@ class GithubPrivateRepositoryDeployKey extends Component
public function mount()
{
if (is_dev()) {
if (isDev()) {
$this->repository_url = 'https://github.com/coollabsio/coolify-examples';
}
$this->parameters = get_route_parameters();

View File

@@ -45,7 +45,7 @@ class PublicGitRepository extends Component
public function mount()
{
if (is_dev()) {
if (isDev()) {
$this->repository_url = 'https://github.com/coollabsio/coolify-examples';
$this->port = 3000;
}

View File

@@ -19,7 +19,7 @@ class SimpleDockerfile extends Component
{
$this->parameters = get_route_parameters();
$this->query = request()->query();
if (is_dev()) {
if (isDev()) {
$this->dockerfile = 'FROM nginx
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -15,7 +15,7 @@ class InviteLink extends Component
public function mount()
{
$this->email = is_dev() ? 'test3@example.com' : '';
$this->email = isDev() ? 'test3@example.com' : '';
}
public function viaEmail()

View File

@@ -36,7 +36,7 @@ class Create extends Component
public function mount()
{
if (is_dev()) {
if (isDev()) {
$this->name = 'Local MinIO';
$this->description = 'Local MinIO';
$this->key = 'minioadmin';

View File

@@ -18,7 +18,7 @@ class Upgrade extends Component
$this->latestVersion = get_latest_version_of_coolify();
$currentVersion = config('version');
version_compare($currentVersion, $this->latestVersion, '<') ? $this->isUpgradeAvailable = true : $this->isUpgradeAvailable = false;
if (is_dev()) {
if (isDev()) {
$this->isUpgradeAvailable = true;
}
$settings = InstanceSettings::get();

View File

@@ -17,7 +17,7 @@ class Waitlist extends Component
];
public function mount()
{
if (is_dev()) {
if (isDev()) {
$this->email = 'waitlist@example.com';
}
}

View File

@@ -32,7 +32,7 @@ class DockerCleanupJob implements ShouldQueue
try {
$servers = Server::all();
foreach ($servers as $server) {
if (is_dev()) {
if (isDev()) {
$docker_root_filesystem = "/";
} else {
$docker_root_filesystem = instant_remote_process(['stat --printf=%m $(docker info --format "{{json .DockerRootDir}}" |sed \'s/"//g\')'], $server);