likyh commented on code in PR #2212:
URL: https://github.com/apache/incubator-devlake/pull/2212#discussion_r898768013


##########
plugins/gitlab/impl/impl.go:
##########
@@ -82,8 +85,23 @@ func (plugin Gitlab) PrepareTaskData(taskCtx 
core.TaskContext, options map[strin
        if err != nil {
                return nil, err
        }
-
+       if op.ConnectionId == 0 {
+               return nil, fmt.Errorf("connectionId is invalid")
+       }
+       connection := &models.GitlabConnection{}
+       connectionHelper := helper.NewConnectionHelper(
+               taskCtx,
+               nil,
+       )
+       if err != nil {
+               return nil, err
+       }
+       err = connectionHelper.FirstById(connection, op.ConnectionId)
+       if err != nil {
+               return nil, err
+       }
        apiClient, err := tasks.NewGitlabApiClient(taskCtx)

Review Comment:
   Should use the connection to NewGitlabApiClient instead of using getConfig.



##########
config/config.go:
##########
@@ -45,13 +45,12 @@ func initConfig(v *viper.Viper) {
        v.SetConfigType("env")
        envPath := getEnvPath()
        // AddConfigPath adds a path for Viper to search for the config file in.
-       if envPath == "" {

Review Comment:
   I have no idea about this 😹



##########
plugins/gitlab/gitlab.go:
##########
@@ -30,11 +30,14 @@ var PluginEntry impl.Gitlab //nolint
 func main() {
        gitlabCmd := &cobra.Command{Use: "gitlab"}
        projectId := gitlabCmd.Flags().IntP("project-id", "p", 0, "gitlab 
project id")
+       connectionId := gitlabCmd.Flags().Uint64P("connection-id", "c", 0, 
"gitlab connection id")

Review Comment:
   we have some different styles of cmd flags. Such as: "connectionId", 
"connection", "connection-id".
   Let's start a issue to talk about this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to