mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-17 01:43:40 +00:00
rename forge properties
This commit is contained in:
@@ -125,12 +125,12 @@ func PatchForge(c *gin.Context) {
|
||||
}
|
||||
forge.URL = in.URL
|
||||
forge.Type = in.Type
|
||||
forge.Client = in.Client
|
||||
forge.OAuthClientID = in.OAuthClientID
|
||||
forge.OAuthHost = in.OAuthHost
|
||||
forge.SkipVerify = in.SkipVerify
|
||||
forge.AdditionalOptions = in.AdditionalOptions
|
||||
if in.ClientSecret != "" {
|
||||
forge.ClientSecret = in.ClientSecret
|
||||
forge.OAuthClientSecret = in.ClientSecret
|
||||
}
|
||||
|
||||
err = _store.ForgeUpdate(forge)
|
||||
@@ -163,8 +163,8 @@ func PostForge(c *gin.Context) {
|
||||
forge := &model.Forge{
|
||||
URL: in.URL,
|
||||
Type: in.Type,
|
||||
Client: in.Client,
|
||||
ClientSecret: in.ClientSecret,
|
||||
OAuthClientID: in.OAuthClientID,
|
||||
OAuthClientSecret: in.OAuthClientSecret,
|
||||
OAuthHost: in.OAuthHost,
|
||||
SkipVerify: in.SkipVerify,
|
||||
AdditionalOptions: in.AdditionalOptions,
|
||||
|
@@ -41,8 +41,8 @@ func Forge(forge *model.Forge) (forge.Forge, error) {
|
||||
|
||||
func setupBitbucket(forge *model.Forge) (forge.Forge, error) {
|
||||
opts := &bitbucket.Opts{
|
||||
OAuthClientID: forge.Client,
|
||||
OAuthClientSecret: forge.ClientSecret,
|
||||
OAuthClientID: forge.OAuthClientID,
|
||||
OAuthClientSecret: forge.OAuthClientSecret,
|
||||
}
|
||||
|
||||
log.Debug().
|
||||
@@ -61,8 +61,8 @@ func setupGitea(forge *model.Forge) (forge.Forge, error) {
|
||||
|
||||
opts := gitea.Opts{
|
||||
URL: strings.TrimRight(serverURL.String(), "/"),
|
||||
OAuthClientID: forge.Client,
|
||||
OAuthClientSecret: forge.ClientSecret,
|
||||
OAuthClientID: forge.OAuthClientID,
|
||||
OAuthClientSecret: forge.OAuthClientSecret,
|
||||
SkipVerify: forge.SkipVerify,
|
||||
OAuthHost: forge.OAuthHost,
|
||||
}
|
||||
@@ -88,8 +88,8 @@ func setupForgejo(forge *model.Forge) (forge.Forge, error) {
|
||||
|
||||
opts := forgejo.Opts{
|
||||
URL: strings.TrimRight(server.String(), "/"),
|
||||
OAuthClientID: forge.Client,
|
||||
OAuthClientSecret: forge.ClientSecret,
|
||||
OAuthClientID: forge.OAuthClientID,
|
||||
OAuthClientSecret: forge.OAuthClientSecret,
|
||||
SkipVerify: forge.SkipVerify,
|
||||
OAuth2URL: forge.OAuthHost,
|
||||
}
|
||||
@@ -110,8 +110,8 @@ func setupForgejo(forge *model.Forge) (forge.Forge, error) {
|
||||
func setupGitLab(forge *model.Forge) (forge.Forge, error) {
|
||||
opts := gitlab.Opts{
|
||||
URL: forge.URL,
|
||||
OAuthClientID: forge.Client,
|
||||
OAuthClientSecret: forge.ClientSecret,
|
||||
OAuthClientID: forge.OAuthClientID,
|
||||
OAuthClientSecret: forge.OAuthClientSecret,
|
||||
SkipVerify: forge.SkipVerify,
|
||||
OAuthHost: forge.OAuthHost,
|
||||
}
|
||||
@@ -139,8 +139,8 @@ func setupGitHub(forge *model.Forge) (forge.Forge, error) {
|
||||
|
||||
opts := github.Opts{
|
||||
URL: forge.URL,
|
||||
OAuthClientID: forge.Client,
|
||||
OAuthClientSecret: forge.ClientSecret,
|
||||
OAuthClientID: forge.OAuthClientID,
|
||||
OAuthClientSecret: forge.OAuthClientSecret,
|
||||
SkipVerify: forge.SkipVerify,
|
||||
MergeRef: mergeRef,
|
||||
OnlyPublic: publicOnly,
|
||||
@@ -171,8 +171,8 @@ func setupBitbucketDatacenter(forge *model.Forge) (forge.Forge, error) {
|
||||
|
||||
opts := bitbucketdatacenter.Opts{
|
||||
URL: forge.URL,
|
||||
OAuthClientID: forge.Client,
|
||||
OAuthClientSecret: forge.ClientSecret,
|
||||
OAuthClientID: forge.OAuthClientID,
|
||||
OAuthClientSecret: forge.OAuthClientSecret,
|
||||
Username: gitUsername,
|
||||
Password: gitPassword,
|
||||
OAuthHost: forge.OAuthHost,
|
||||
|
@@ -30,8 +30,8 @@ type Forge struct {
|
||||
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
|
||||
OAuthClientID string `json:"client,omitempty" xorm:"VARCHAR(250)"`
|
||||
OAuthClientSecret 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"`
|
||||
|
@@ -115,8 +115,8 @@ func setupForgeService(c *cli.Command, _store store.Store) error {
|
||||
_forge.AdditionalOptions = make(map[string]any)
|
||||
}
|
||||
|
||||
_forge.Client = strings.TrimSpace(c.String("forge-oauth-client"))
|
||||
_forge.ClientSecret = strings.TrimSpace(c.String("forge-oauth-secret"))
|
||||
_forge.OAuthClientID = strings.TrimSpace(c.String("forge-oauth-client"))
|
||||
_forge.OAuthClientSecret = strings.TrimSpace(c.String("forge-oauth-secret"))
|
||||
_forge.URL = c.String("forge-url")
|
||||
_forge.SkipVerify = c.Bool("forge-skip-verify")
|
||||
_forge.OAuthHost = c.String("forge-oauth-host")
|
||||
|
@@ -27,11 +27,11 @@ func TestForgeCRUD(t *testing.T) {
|
||||
defer closer()
|
||||
|
||||
forge1 := &model.Forge{
|
||||
Type: "github",
|
||||
URL: "https://github.com",
|
||||
Client: "client",
|
||||
ClientSecret: "secret",
|
||||
SkipVerify: false,
|
||||
Type: "github",
|
||||
URL: "https://github.com",
|
||||
OAuthClientID: "client",
|
||||
OAuthClientSecret: "secret",
|
||||
SkipVerify: false,
|
||||
AdditionalOptions: map[string]any{
|
||||
"foo": "bar",
|
||||
},
|
||||
|
Reference in New Issue
Block a user