aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bridge/bridges.go2
-rw-r--r--bridge/core/bridge.go1
-rw-r--r--bridge/github/config.go8
-rw-r--r--commands/bridge_rm.go2
4 files changed, 7 insertions, 6 deletions
diff --git a/bridge/bridges.go b/bridge/bridges.go
index 0aa0007f..ce6013e3 100644
--- a/bridge/bridges.go
+++ b/bridge/bridges.go
@@ -37,6 +37,6 @@ func ConfiguredBridges(repo repository.RepoCommon) ([]string, error) {
}
// Remove a configured bridge
-func RemoveBridges(repo repository.RepoCommon, name string) error {
+func RemoveBridge(repo repository.RepoCommon, name string) error {
return core.RemoveBridge(repo, name)
}
diff --git a/bridge/core/bridge.go b/bridge/core/bridge.go
index 2b2db0a2..4b93be7f 100644
--- a/bridge/core/bridge.go
+++ b/bridge/core/bridge.go
@@ -236,7 +236,6 @@ func (b *Bridge) loadConfig() (Configuration, error) {
result := make(Configuration, len(pairs))
for key, value := range pairs {
key := strings.TrimPrefix(key, keyPrefix)
- fmt.Println(key, value)
result[key] = value
}
diff --git a/bridge/github/config.go b/bridge/github/config.go
index 9c1bbcbb..1971abbc 100644
--- a/bridge/github/config.go
+++ b/bridge/github/config.go
@@ -17,7 +17,6 @@ import (
"time"
"github.com/pkg/errors"
-
"golang.org/x/crypto/ssh/terminal"
"github.com/MichaelMure/git-bug/bridge/core"
@@ -25,6 +24,7 @@ import (
)
const (
+ target = "github"
githubV3Url = "https://api.github.com"
keyTarget = "target"
keyOwner = "owner"
@@ -102,7 +102,7 @@ func (*Github) Configure(repo repository.RepoCommon, params core.BridgeParams) (
return nil, fmt.Errorf("project doesn't exist or authentication token has an incorrect scope")
}
- conf[keyTarget] = "github"
+ conf[keyTarget] = target
conf[keyToken] = token
conf[keyOwner] = owner
conf[keyProject] = project
@@ -111,8 +111,10 @@ func (*Github) Configure(repo repository.RepoCommon, params core.BridgeParams) (
}
func (*Github) ValidateConfig(conf core.Configuration) error {
- if _, ok := conf[keyTarget]; !ok {
+ if v, ok := conf[keyTarget]; !ok {
return fmt.Errorf("missing %s key", keyTarget)
+ } else if v != target {
+ return fmt.Errorf("unexpected target name: %v", v)
}
if _, ok := conf[keyToken]; !ok {
diff --git a/commands/bridge_rm.go b/commands/bridge_rm.go
index 80a831ff..5d38083c 100644
--- a/commands/bridge_rm.go
+++ b/commands/bridge_rm.go
@@ -15,7 +15,7 @@ func runBridgeRm(cmd *cobra.Command, args []string) error {
defer backend.Close()
interrupt.RegisterCleaner(backend.Close)
- err = bridge.RemoveBridges(backend, args[0])
+ err = bridge.RemoveBridge(backend, args[0])
if err != nil {
return err
}