mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-21 23:20:24 +00:00
update
This commit is contained in:
parent
8f2db60f28
commit
e918c6457e
3 changed files with 12 additions and 6 deletions
|
@ -33,6 +33,11 @@ class GitRepositoryResource extends Resource
|
|||
->required()
|
||||
->columnSpanFull(),
|
||||
|
||||
Forms\Components\Select::make('git_ssh_key_id')
|
||||
->label('SSH Key')
|
||||
->options(fn () => \App\Models\GitSshKey::pluck('name', 'id'))
|
||||
->columnSpanFull(),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,10 +71,12 @@ class GitRepository extends Model
|
|||
return $this->belongsTo(Domain::class);
|
||||
}
|
||||
|
||||
private function _getSSHKey($findHostingSubscription)
|
||||
private function _getSSHKey($gitSshKeyId, $findHostingSubscription)
|
||||
{
|
||||
$gitSSHKey = GitSshKey::where('id', $gitSshKeyId)
|
||||
->where('hosting_subscription_id', $findHostingSubscription->id)
|
||||
->first();
|
||||
|
||||
$gitSSHKey = GitSshKey::find($this->git_ssh_key_id);
|
||||
if ($gitSSHKey) {
|
||||
$sshPath = '/home/'.$findHostingSubscription->system_username .'/.ssh';
|
||||
$privateKeyFile = $sshPath.'/id_rsa_'. $gitSSHKey->id;
|
||||
|
@ -131,12 +133,11 @@ class GitRepository extends Model
|
|||
$projectDir = $findDomain->domain_root . '/' . $this->dir;
|
||||
|
||||
$privateKeyFile = null;
|
||||
$getSSHKey = $this->_getSSHKey($findHostingSubscription);
|
||||
$getSSHKey = $this->_getSSHKey($this->git_ssh_key_id, $findHostingSubscription);
|
||||
if (isset($getSSHKey['privateKeyFile'])) {
|
||||
$privateKeyFile = $getSSHKey['privateKeyFile'];
|
||||
}
|
||||
|
||||
|
||||
$gitSSHUrl = GitClient::parseGitUrl($this->url);
|
||||
if (!isset($gitSSHUrl['provider'])) {
|
||||
$this->status = self::STATUS_FAILED;
|
||||
|
@ -190,7 +191,7 @@ class GitRepository extends Model
|
|||
$projectDir = $findDomain->domain_root . '/' . $this->dir;
|
||||
|
||||
$privateKeyFile = null;
|
||||
$getSSHKey = $this->_getSSHKey($findHostingSubscription);
|
||||
$getSSHKey = $this->_getSSHKey($this->git_ssh_key_id, $findHostingSubscription);
|
||||
if (isset($getSSHKey['privateKeyFile'])) {
|
||||
$privateKeyFile = $getSSHKey['privateKeyFile'];
|
||||
}
|
||||
|
|
|
@ -18,4 +18,4 @@ su -m {{$systemUsername}} -c 'git clone {{$cloneUrl}} {{$projectDir}}'
|
|||
|
||||
phyre-php /usr/local/phyre/web/artisan git-repository:mark-as-cloned {{$gitRepositoryId}}
|
||||
|
||||
# rm -rf /tmp/git-clone-{{$gitRepositoryId}}.sh
|
||||
rm -rf /tmp/git-clone-{{$gitRepositoryId}}.sh
|
||||
|
|
Loading…
Reference in a new issue