Skip to main content

@glpkg/config

A CLI tool for managing GitLab configuration - save and load tokens from your user config directory.

Installation

# From npm Registry
npm install -g @glpkg/config

# Or use directly with npx
npx @glpkg/config [command]

Features

  • Secure token storage in user config directory
  • Cross-platform support (Linux, macOS, Windows)
  • Simple CLI interface
  • Programmatic API for other tools

Usage

gitlab-config [command] [options]

Commands

set-token - Store GitLab Token

Save your GitLab personal access token:

gitlab-config set-token YOUR_TOKEN

The token is stored in:

  • Linux: ~/.config/glpkg/config.json
  • macOS: ~/Library/Application Support/glpkg/config.json
  • Windows: %APPDATA%\glpkg\config.json

show - Display Current Configuration

View the current configuration:

gitlab-config show

This shows:

  • Token status (configured or not)
  • Configuration file location
  • Other settings

clear - Remove Configuration

Remove all stored configuration:

gitlab-config clear

Programmatic Usage

You can also use @glpkg/config as a library:

import { getConfig, setToken, clearConfig } from '@glpkg/config';

// Get current config
const config = getConfig();
console.log(config.token); // Your stored token

// Set a new token
setToken('glpat-xxxxxxxxxxxx');

// Clear all config
clearConfig();

API Reference

getConfig(): Config

Returns the current configuration object.

interface Config {
token?: string;
registry?: string;
}

setToken(token: string): void

Stores the GitLab token in the config file.

clearConfig(): void

Removes all stored configuration.

getConfigPath(): string

Returns the path to the configuration file.

Token Precedence

When glpkg tools look for a token, they check in this order:

  1. Command-line option (--token)
  2. Environment variable (GITLAB_AUTH_TOKEN)
  3. Project .env file
  4. User config (via @glpkg/config)

Security Notes

  • Tokens are stored in plain text in your user config directory
  • The config directory has restrictive permissions (700)
  • Never commit tokens to version control
  • Use environment variables in CI/CD pipelines

Integration with Other Tools

@glpkg/config is used by:

When you configure a token with @glpkg/config, both installer and publisher can use it automatically.