This is an automated email from the ASF dual-hosted git repository.
warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 96572110 fix: jira connections api should not depend on encKey
96572110 is described below
commit 96572110129fd4cca7bbe98ac7e62564a6faaf2c
Author: Klesh Wong <[email protected]>
AuthorDate: Mon May 30 19:43:09 2022 +0800
fix: jira connections api should not depend on encKey
Fixes #2032
---
plugins/jira/api/connection.go | 6 +++---
plugins/jira/api/init.go | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/plugins/jira/api/connection.go b/plugins/jira/api/connection.go
index 1aa64f3f..96970d77 100644
--- a/plugins/jira/api/connection.go
+++ b/plugins/jira/api/connection.go
@@ -128,7 +128,7 @@ func getJiraConnectionById(id uint64)
(*models.JiraConnection, error) {
encKey := v.GetString(core.EncodeKeyEnvStr)
jiraConnection.BasicAuthEncoded, err = core.Decrypt(encKey,
jiraConnection.BasicAuthEncoded)
if err != nil {
- return nil, err
+ log.Error("failed to decrypt basic auth: %s", err)
}
return jiraConnection, nil
@@ -200,7 +200,7 @@ func refreshAndSaveJiraConnection(jiraConnection
*models.JiraConnection, data ma
jiraConnection.BasicAuthEncoded, err = core.Decrypt(encKey,
jiraConnection.BasicAuthEncoded)
if err != nil {
- return err
+ log.Error("failed to decrypt basic auth: %s", err)
}
return nil
}
@@ -316,7 +316,7 @@ func ListConnections(input *core.ApiResourceInput)
(*core.ApiResourceOutput, err
for i := range jiraConnections {
jiraConnections[i].BasicAuthEncoded, err = core.Decrypt(encKey,
jiraConnections[i].BasicAuthEncoded)
if err != nil {
- return nil, err
+ log.Error("failed to decrypt basic auth: %s", err)
}
}
return &core.ApiResourceOutput{Body: jiraConnections}, nil
diff --git a/plugins/jira/api/init.go b/plugins/jira/api/init.go
index fc8588d5..663d5033 100644
--- a/plugins/jira/api/init.go
+++ b/plugins/jira/api/init.go
@@ -25,8 +25,10 @@ import (
var db *gorm.DB
var cfg *viper.Viper
+var log core.Logger
func Init(config *viper.Viper, logger core.Logger, database *gorm.DB) {
db = database
cfg = config
+ log = logger
}