aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/launchpad
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-15 03:01:45 +0100
committerGitHub <noreply@github.com>2020-02-15 03:01:45 +0100
commit362c0c7e2e1ce9a8e2918376a340c76f46569d64 (patch)
tree29f04fae0dc3d5d4883d4989012c26109ba754dc /bridge/launchpad
parent2df72942f2b057956c7873f908b64880ab647331 (diff)
parentfe3d5c95e4be5874066402b5463ada34894c7f01 (diff)
downloadgit-bug-362c0c7e2e1ce9a8e2918376a340c76f46569d64.tar.gz
Merge pull request #325 from MichaelMure/bridge-refactor
bridges: massive refactor
Diffstat (limited to 'bridge/launchpad')
-rw-r--r--bridge/launchpad/config.go23
-rw-r--r--bridge/launchpad/launchpad.go4
2 files changed, 12 insertions, 15 deletions
diff --git a/bridge/launchpad/config.go b/bridge/launchpad/config.go
index e029fad3..8567675f 100644
--- a/bridge/launchpad/config.go
+++ b/bridge/launchpad/config.go
@@ -13,18 +13,14 @@ import (
var ErrBadProjectURL = errors.New("bad Launchpad project URL")
-func (l *Launchpad) Configure(repo *cache.RepoCache, params core.BridgeParams) (core.Configuration, error) {
- if params.TokenRaw != "" {
- fmt.Println("warning: token params are ineffective for a Launchpad bridge")
- }
- if params.Owner != "" {
- fmt.Println("warning: --owner is ineffective for a Launchpad bridge")
- }
- if params.BaseURL != "" {
- fmt.Println("warning: --base-url is ineffective for a Launchpad bridge")
+func (Launchpad) ValidParams() map[string]interface{} {
+ return map[string]interface{}{
+ "URL": nil,
+ "Project": nil,
}
+}
- conf := make(core.Configuration)
+func (l *Launchpad) Configure(repo *cache.RepoCache, params core.BridgeParams) (core.Configuration, error) {
var err error
var project string
@@ -52,8 +48,9 @@ func (l *Launchpad) Configure(repo *cache.RepoCache, params core.BridgeParams) (
return nil, fmt.Errorf("project doesn't exist")
}
+ conf := make(core.Configuration)
conf[core.ConfigKeyTarget] = target
- conf[keyProject] = project
+ conf[confKeyProject] = project
err = l.ValidateConfig(conf)
if err != nil {
@@ -70,8 +67,8 @@ func (*Launchpad) ValidateConfig(conf core.Configuration) error {
return fmt.Errorf("unexpected target name: %v", v)
}
- if _, ok := conf[keyProject]; !ok {
- return fmt.Errorf("missing %s key", keyProject)
+ if _, ok := conf[confKeyProject]; !ok {
+ return fmt.Errorf("missing %s key", confKeyProject)
}
return nil
diff --git a/bridge/launchpad/launchpad.go b/bridge/launchpad/launchpad.go
index b4fcdd00..51ee79d2 100644
--- a/bridge/launchpad/launchpad.go
+++ b/bridge/launchpad/launchpad.go
@@ -13,7 +13,7 @@ const (
metaKeyLaunchpadID = "launchpad-id"
metaKeyLaunchpadLogin = "launchpad-login"
- keyProject = "project"
+ confKeyProject = "project"
defaultTimeout = 60 * time.Second
)
@@ -26,7 +26,7 @@ func (*Launchpad) Target() string {
return "launchpad-preview"
}
-func (l *Launchpad) LoginMetaKey() string {
+func (Launchpad) LoginMetaKey() string {
return metaKeyLaunchpadLogin
}