refactored how remotes work and how (some) config is loaded

This commit is contained in:
Brad Rydzewski
2014-09-03 00:23:36 -07:00
parent 38379992bf
commit ca3d15bca2
8 changed files with 173 additions and 118 deletions

View File

@@ -1,16 +1,22 @@
package gitlab
import (
"os"
"github.com/drone/config"
"github.com/drone/drone/plugin/remote"
)
// registers the Gitlab plugin
func init() {
var url = os.Getenv("GITLAB_URL")
if len(url) == 0 {
var (
gitlabURL = config.String("gitlab-url", "")
)
// Registers the Gitlab plugin using the default
// settings from the config file or environment
// variables.
func Register() {
if len(*gitlabURL) == 0 {
return
}
remote.Register(New(url))
remote.Register(
New(*gitlabURL),
)
}