@glpkg/config
v0.3.4
Published
GitLab configuration management - save and load tokens from user config directory
Readme
@microature/gitlab-config
GitLab configuration management - save and load tokens from user config directory (~/.config/gitlab-config).
Installation
npm install -g @microature/gitlab-configUsage
CLI
# Save a token
gitlab-config save glpat-your-token-here
# Get saved token
gitlab-config get
# Check if token exists
gitlab-config check
# Remove token
gitlab-config removeSee CLI Documentation for detailed command reference.
Programmatic API
import { saveToken, getToken, hasToken, removeToken } from '@microature/gitlab-config';
// Save a token
saveToken('glpat-your-token-here');
// Get the token
const token = getToken(); // Returns token or null if not found
// Check if token exists
if (hasToken()) {
console.log('Token is configured');
}
// Remove the token
removeToken();API
See the API documentation for detailed information.
Functions
saveToken(token: string): void- Save GitLab token to~/.config/gitlab-config/tokengetToken(): string | null- Get GitLab token or null if not foundhasToken(): boolean- Check if token existsremoveToken(): void- Remove saved token
How It Works
- Tokens are stored in
~/.config/gitlab-config/token - The config directory is automatically created if it doesn't exist
- Token file is created with
0600permissions (read/write for owner only) - Returns
nullif token file doesn't exist or is empty
License
ISC
