summaryrefslogtreecommitdiffstatshomepage
path: root/bridge/github/config.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-06-17 14:24:17 +0200
committerGitHub <noreply@github.com>2019-06-17 14:24:17 +0200
commit470996a0cef56551262a2fb436b778d8fe4be941 (patch)
treee133293f9f297747e5f6f1747d3a37ce8e5aff4f /bridge/github/config.go
parentd69dcce806d280ddbd6a4fb17700153bc03da90b (diff)
parent316b4ea6c241960c7506fc5b4d76a4e31484465c (diff)
downloadgit-bug-470996a0cef56551262a2fb436b778d8fe4be941.tar.gz
git-bug-470996a0cef56551262a2fb436b778d8fe4be941.zip
Merge pull request #170 from A-Hilaly/config-file
[bridge] Change bridge name format in the config
Diffstat (limited to 'bridge/github/config.go')
-rw-r--r--bridge/github/config.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/bridge/github/config.go b/bridge/github/config.go
index 707b3e2f..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,7 +24,9 @@ import (
)
const (
+ target = "github"
githubV3Url = "https://api.github.com"
+ keyTarget = "target"
keyOwner = "owner"
keyProject = "project"
keyToken = "token"
@@ -101,6 +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] = target
conf[keyToken] = token
conf[keyOwner] = owner
conf[keyProject] = project
@@ -109,6 +111,12 @@ func (*Github) Configure(repo repository.RepoCommon, params core.BridgeParams) (
}
func (*Github) ValidateConfig(conf core.Configuration) error {
+ 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 {
return fmt.Errorf("missing %s key", keyToken)
}