aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/jira/config.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-23 19:20:45 +0100
committerGitHub <noreply@github.com>2020-02-23 19:20:45 +0100
commit8ef6438fb476e9d510a39ead321cbeee6288e2d2 (patch)
tree2bcd2a5420bbdbed13b3de82992c30b7d17893e2 /bridge/jira/config.go
parent0e68c10ffc3f9e72e32b8cdfcd917b3fe1ab240c (diff)
parent0cebe1e57e7e4b03aef77cd11bd4fc683c32afc6 (diff)
downloadgit-bug-8ef6438fb476e9d510a39ead321cbeee6288e2d2.tar.gz
Merge pull request #341 from MichaelMure/bridges-default-login
bridge: record the login used during the configure and use it as default credential
Diffstat (limited to 'bridge/jira/config.go')
-rw-r--r--bridge/jira/config.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/bridge/jira/config.go b/bridge/jira/config.go
index 79fd8507..1a6ab18a 100644
--- a/bridge/jira/config.go
+++ b/bridge/jira/config.go
@@ -79,7 +79,7 @@ func (j *Jira) Configure(repo *cache.RepoCache, params core.BridgeParams) (core.
}
login = l
default:
- login := params.Login
+ login = params.Login
if login == "" {
// TODO: validate username
login, err = input.Prompt("JIRA login", "login", input.Required)
@@ -98,6 +98,7 @@ func (j *Jira) Configure(repo *cache.RepoCache, params core.BridgeParams) (core.
conf[confKeyBaseUrl] = baseURL
conf[confKeyProject] = project
conf[confKeyCredentialType] = credType
+ conf[confKeyDefaultLogin] = login
err = j.ValidateConfig(conf)
if err != nil {
@@ -144,10 +145,18 @@ func (*Jira) ValidateConfig(conf core.Configuration) error {
} else if v != target {
return fmt.Errorf("unexpected target name: %v", v)
}
-
+ if _, ok := conf[confKeyBaseUrl]; !ok {
+ return fmt.Errorf("missing %s key", confKeyBaseUrl)
+ }
if _, ok := conf[confKeyProject]; !ok {
return fmt.Errorf("missing %s key", confKeyProject)
}
+ if _, ok := conf[confKeyCredentialType]; !ok {
+ return fmt.Errorf("missing %s key", confKeyCredentialType)
+ }
+ if _, ok := conf[confKeyDefaultLogin]; !ok {
+ return fmt.Errorf("missing %s key", confKeyDefaultLogin)
+ }
return nil
}