1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-11-23 21:44:44 +02:00

Add api for forges (#3733)

This commit is contained in:
Anbraten
2024-06-20 13:08:54 +02:00
committed by GitHub
parent eadead6c07
commit fbb96ff8f5
15 changed files with 611 additions and 98 deletions

View File

@@ -27,12 +27,23 @@ const (
)
type Forge struct {
ID int64 `xorm:"pk autoincr 'id'"`
Type ForgeType `xorm:"VARCHAR(250)"`
URL string `xorm:"VARCHAR(500) 'url'"`
Client string `xorm:"VARCHAR(250)"`
ClientSecret string `xorm:"VARCHAR(250)"`
SkipVerify bool `xorm:"bool"`
OAuthHost string `xorm:"VARCHAR(250) 'oauth_host'"` // public url for oauth if different from url
AdditionalOptions map[string]any `xorm:"json"`
ID int64 `json:"id" xorm:"pk autoincr 'id'"`
Type ForgeType `json:"type" xorm:"VARCHAR(250)"`
URL string `json:"url" xorm:"VARCHAR(500) 'url'"`
Client string `json:"client,omitempty" xorm:"VARCHAR(250)"`
ClientSecret string `json:"-" xorm:"VARCHAR(250)"` // do not expose client secret
SkipVerify bool `json:"skip_verify,omitempty" xorm:"bool"`
OAuthHost string `json:"oauth_host,omitempty" xorm:"VARCHAR(250) 'oauth_host'"` // public url for oauth if different from url
AdditionalOptions map[string]any `json:"additional_options,omitempty" xorm:"json"`
} // @name Forge
// PublicCopy returns a copy of the forge without sensitive information and technical details.
func (f *Forge) PublicCopy() *Forge {
forge := &Forge{
ID: f.ID,
Type: f.Type,
URL: f.URL,
}
return forge
}