From 5b1a8cdefa9516d215f99ee114d451c96997f34a Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 7 Jul 2019 11:10:58 +0200 Subject: bridge: use a single KeyTarget constant for all bridges --- bridge/github/config.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'bridge/github') diff --git a/bridge/github/config.go b/bridge/github/config.go index 1971abbc..a9a25ec0 100644 --- a/bridge/github/config.go +++ b/bridge/github/config.go @@ -26,7 +26,6 @@ import ( const ( target = "github" githubV3Url = "https://api.github.com" - keyTarget = "target" keyOwner = "owner" keyProject = "project" keyToken = "token" @@ -102,7 +101,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[core.KeyTarget] = target conf[keyToken] = token conf[keyOwner] = owner conf[keyProject] = project @@ -111,8 +110,8 @@ 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) + if v, ok := conf[core.KeyTarget]; !ok { + return fmt.Errorf("missing %s key", core.KeyTarget) } else if v != target { return fmt.Errorf("unexpected target name: %v", v) } -- cgit