Deny deleting the default github.com endpoint
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
208a4eea37
commit
eb1456479b
1 changed files with 4 additions and 0 deletions
|
|
@ -214,6 +214,10 @@ func (s *sqlDatabase) DeleteGithubEndpoint(_ context.Context, name string) error
|
|||
return errors.Wrap(err, "fetching github endpoint")
|
||||
}
|
||||
|
||||
if endpoint.Name == "github.com" {
|
||||
return errors.New("cannot delete default github endpoint")
|
||||
}
|
||||
|
||||
var credsCount int64
|
||||
if err := tx.Model(&GithubCredentials{}).Where("endpoint_name = ?", endpoint.Name).Count(&credsCount).Error; err != nil {
|
||||
if !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue