Socket
Socket
Sign inDemoInstall

sinopia-gitlab-api-v4

Package Overview
Dependencies
49
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

sinopia-gitlab-api-v4

Gitlab authentication plugin for sinopia


Version published
Maintainers
1
Weekly downloads
1

Weekly downloads

Readme

Source

sinopia-gitlab

Sinopia plugin for Gitlab authentication and package access/publish authorization.

This plugin allows authentication to Sinopia using a gitlab username and password. It also checks access levels for users and projects before allowing access to project code (minimum level "Reporter") or publish access (minimum level "Master").

Configuration

auth:
  gitlab:
    gitlab_server: https://git.example.com
    gitlab_admin_private_token: XXXXXXXXXXXX    # (Recommended) You can use private token here
    gitlab_use_scope_as_group: false            # (Optional) Match scope as group (Default false)group/scope-project
    gitlab_project_prefix: npm-                 # (Optional) Use this if you prefix your projects in gitlab
    gitlab_retain_group: false                  # (Optional) Use this to retain group name when perform project name conversion

    #gitlab_ca_file: /path/to/ca/ca.crt         # (Optional) Use for self-signed certificates

packages:
  '@*/*':
    gitlab: true

  'scope-*':
    gitlab: true

  'prefix-*':
    gitlab: true

  '*':
    allow_access: $authenticated
    allow_publish: []
    proxy: npmjs

Test your configuration

// Import
var SinopiaGitlab = require('sinopia-gitlab');
// Initialize
var sinopiaGitlab = SinopiaGitlab({
  // your configuration goes here
  gitlab_project_prefix: '',
  gitlab_use_scope_as_group: false,
  gitlab_namespaces: [],
  gitlab_retain_group: false
}, {
  // Set environment to test config
  _test_config: true
});

// Run test
var packageName = '@ns/scope-name';
sinopiaGitlab._testConfig(packageName, function(err, result) {
  // Check the conversion result
  console.log(result);
});

Package name to GitLab project name conversion

// This only show the process of conversion of one entry of gitlab_namespaces
// package name is '@ns/scope-name'

i = 0

if (gitlab_use_scope_as_group)
    namespace = gitlab_retain_group ? 'ns/scope' : 'scope'
else
    namespace = 'ns'

project = gitlab_project_prefix + 'name'

if (gitlab_namespaces[i])
    namespace = gitlab_retain_group ? namespace + '/' + gitlab_namespaces[i] : gitlab_namespaces[i]

Configuration examples

Default:

gitlab_project_prefix: ''
gitlab_use_scope_as_group: false
gitlab_namespaces: []
gitlab_retain_group: false
NPM Project NameGitLab Project Name
project-aproject-a
@mysterious/project-bmysterious/project-b

Config 1: prefixed

gitlab_project_prefix: 'my-'
gitlab_use_scope_as_group: false
gitlab_namespaces: []
gitlab_retain_group: false
NPM Project NameGitLab Project Name
project-amy-project-a
@mysterious/project-bmysterious/my-project-b

Config 2: use scope as group

gitlab_project_prefix: ''
gitlab_use_scope_as_group: true
gitlab_namespaces: []
gitlab_retain_group: false
NPM Project NameGitLab Project Name
project-aproject/a
@mysterious/project-bproject/b

Config 3: namespace

gitlab_project_prefix: ''
gitlab_use_scope_as_group: false
gitlab_namespaces: [npm]
gitlab_retain_group: false
NPM Project NameGitLab Project Name
project-anpm/project-a
@mysterious/project-bnpm/project-b

Config 4: namespace, use scope as group, prefixed

gitlab_project_prefix: 'my-'
gitlab_use_scope_as_group: true
gitlab_namespaces: [npm]
gitlab_retain_group: false
NPM Project NameGitLab Project Name
project-anpm/my-a
@mysterious/project-bnpm/my-b

Config 5: retain group, namespace, prefixed

gitlab_project_prefix: 'my-'
gitlab_use_scope_as_group: false
gitlab_namespaces: [npm]
gitlab_retain_group: true

NPM Project NameGitLab Project Name
project-anpm/my-project-a
@mysterious/project-bnpm/mysterious/my-project-b

Config 6: retain group, use scope as group namespace, prefixed

gitlab_project_prefix: 'my-'
gitlab_use_scope_as_group: true
gitlab_namespaces: [npm]
gitlab_retain_group: true
NPM Project NameGitLab Project Name
project-anpm/project/my-a
@mysterious/project-bnpm/mysterious/project/my-b

FAQs

Last updated on 13 Mar 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc