Search code examples
gitlabgitlab-cigitlab-api

npm Gitlab - use of url and token


I am currently trying to use the gitlab module to connect to my gitlab repository but I find the documentation of gitlab too vague to reproduce. The documentation is provided here:

First of all, they say to connect to gitlab you have to do the following:

gitlab = (require 'gitlab')
  url:   'http://example.com'
  token: 'abcdefghij123456'

I dont understand the purpose of this url at all. As for the token what I believe is that the token is used to identify which gitlab account we want to connect to. Am I right here?

My second confusion is a bit more general. They show further in the documentation that you can use this module to listen to 'users' and 'projects'. What exactly are the users here? I understand that the projects are the projects that are hosted by my gitlab account but whats the purpose of the users? Can one account (which I'm assuming we connect to via the token) have multiple users? This is really confusing.

Please explain how to implement this gitlab module. I am looking forward to any insight provided on these queries. Thank you.


Solution

  • I think your question has more to do with the node package than Gitlab itself, you should report issues to their issuetracker.

    To answer some of your questions:

    • Why the url? | Gitlab can also be installed on-premises so this url can be different for a company using its own installation of Gitlab.
    • Token | This is a personal access token, you can create them using these docs and give the token only the permissions it needs. The docs also state the use-cases.
    • Monitor users | This means you can see what users interact with your repo in what way, so e.g. commit, push, create issues, etc.
    • User account | Technicaly a user account has at least 1 login and a login belongs to a user account. Since you can have both a default user account and a connected Google login a user can have more logins. This module seems to focus on users accounts instead of logins though.