From 70a9a588ba073a489cb062d5b86dfbe60e54bd9b Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Sun, 7 Jun 2015 19:48:36 -0700 Subject: [PATCH] refactor to enable multiple builtin remote plugins --- cmd/drone-server/drone.go | 2 +- pkg/config/config.go | 33 +++++++++++++++++++++++ pkg/remote/{ => builtin}/github/github.go | 0 pkg/remote/{ => builtin}/github/helper.go | 0 4 files changed, 34 insertions(+), 1 deletion(-) rename pkg/remote/{ => builtin}/github/github.go (100%) rename pkg/remote/{ => builtin}/github/helper.go (100%) diff --git a/cmd/drone-server/drone.go b/cmd/drone-server/drone.go index 8f80ea6fb..151812d87 100644 --- a/cmd/drone-server/drone.go +++ b/cmd/drone-server/drone.go @@ -9,7 +9,7 @@ import ( "github.com/drone/drone/Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs" "github.com/drone/drone/pkg/config" - "github.com/drone/drone/pkg/remote/github" + "github.com/drone/drone/pkg/remote/builtin/github" "github.com/drone/drone/pkg/server" "github.com/drone/drone/pkg/server/session" diff --git a/pkg/config/config.go b/pkg/config/config.go index 8f7d96343..e68bf38fb 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -61,6 +61,39 @@ type Config struct { // Plugins represents a white-list of plugins // that the system is authorized to load. Plugins []string `envconfig:"optional"` + + Github struct { + Client string `envconfig:"optional"` + Secret string `envconfig:"optional"` + Orgs []string `envconfig:"optional"` + Open bool `envconfig:"optional"` + } + + GithubEnterprise struct { + URL string `envconfig:"optional"` + Client string `envconfig:"optional"` + Secret string `envconfig:"optional"` + Private bool `envconfig:"optional"` + SkipVerify bool `envconfig:"optional"` + Open bool `envconfig:"optional"` + Orgs []string `envconfig:"optional"` + } + + Bitbucket struct { + Client string `envconfig:"optional"` + Secret string `envconfig:"optional"` + Open bool `envconfig:"optional"` + Orgs []string `envconfig:"optional"` + } + + Gitlab struct { + URL string `envconfig:"optional"` + Client string `envconfig:"optional"` + Secret string `envconfig:"optional"` + SkipVerify bool `envconfig:"optional"` + Open bool `envconfig:"optional"` + Orgs []string `envconfig:"optional"` + } } // Load loads the configuration file and reads diff --git a/pkg/remote/github/github.go b/pkg/remote/builtin/github/github.go similarity index 100% rename from pkg/remote/github/github.go rename to pkg/remote/builtin/github/github.go diff --git a/pkg/remote/github/helper.go b/pkg/remote/builtin/github/helper.go similarity index 100% rename from pkg/remote/github/helper.go rename to pkg/remote/builtin/github/helper.go