mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-04-28 22:44:43 +00:00
...so that it's possible to enable or disable open registration on a per-remote basis. For example, the `DRONE_REGISTRATION_OPEN` environment variable now becomes `DRONE_GITHUB_OPEN` when using GitHub as a remote. The default for open registration in this commit is `false` (disabled), which matches the existing behaviour. This is useful if you need to support both public and private remotes, e.g. GitHub.com and GitHub Enterprise, where you trust all of the private users and want to allow open registration for those but would not want all GitHub.com users to run builds on your server. Tested with GitHub and GitLab.
25 lines
615 B
Go
25 lines
615 B
Go
package bitbucket
|
|
|
|
import (
|
|
"github.com/drone/config"
|
|
"github.com/drone/drone/plugin/remote"
|
|
)
|
|
|
|
var (
|
|
// Bitbucket cloud configuration details
|
|
bitbucketClient = config.String("bitbucket-client", "")
|
|
bitbucketSecret = config.String("bitbucket-secret", "")
|
|
bitbucketOpen = config.Bool("bitbucket-open", false)
|
|
)
|
|
|
|
// Registers the Bitbucket plugin using the default
|
|
// settings from the config file or environment
|
|
// variables.
|
|
func Register() {
|
|
if len(*bitbucketClient) == 0 || len(*bitbucketSecret) == 0 {
|
|
return
|
|
}
|
|
remote.Register(
|
|
NewDefault(*bitbucketClient, *bitbucketSecret, *bitbucketOpen),
|
|
)
|
|
}
|