Files
skillshare/website/docs/reference/environment-variables.md
T
Willie 80c2d52fef feat: respect XDG Base Directory Specification (#26)
Add config.BaseDir() as single source of truth for base directory
resolution. Replace all hardcoded ~/.config/skillshare paths.

Path resolution priority:
  1. SKILLSHARE_CONFIG env var (unchanged)
  2. $XDG_CONFIG_HOME/skillshare (any platform)
  3. %AppData%/skillshare (Windows only)
  4. ~/.config/skillshare (Linux, macOS fallback)

- Add config.BaseDir() with XDG_CONFIG_HOME + Windows %AppData% support
- Update BackupDir(), TrashDir(), init default source to use BaseDir()
- Show resolved base directory in doctor output
- Add unit tests and integration tests for XDG override
- Document XDG_CONFIG_HOME and update Windows paths in docs
2026-02-16 01:23:36 +08:00

2.8 KiB

sidebar_position
sidebar_position
2

Environment Variables

All environment variables recognized by skillshare.

Configuration

SKILLSHARE_CONFIG

Override the config file path.

SKILLSHARE_CONFIG=~/custom-config.yaml skillshare status

Default: ~/.config/skillshare/config.yaml


XDG_CONFIG_HOME

Override the base configuration directory per the XDG Base Directory Specification.

export XDG_CONFIG_HOME=~/my-config
# skillshare will use ~/my-config/skillshare/

Default behavior:

Platform Default
Linux ~/.config/skillshare/
macOS ~/.config/skillshare/
Windows %AppData%\skillshare\

Priority: SKILLSHARE_CONFIG > XDG_CONFIG_HOME > platform default.

:::note If you set XDG_CONFIG_HOME after initial setup, move your existing ~/.config/skillshare/ directory to the new location manually. :::


GitHub API

GITHUB_TOKEN

GitHub personal access token for API requests.

When needed:

  • Upgrading skillshare CLI
  • Installing from private repos
  • Hitting rate limits

Usage:

export GITHUB_TOKEN=ghp_your_token_here
skillshare upgrade

Creating a token:

  1. Go to https://github.com/settings/tokens
  2. Generate new token (classic)
  3. No scopes needed for public repos
  4. Copy the token

Windows:

# Current session
$env:GITHUB_TOKEN = "ghp_your_token"

# Permanent
[Environment]::SetEnvironmentVariable("GITHUB_TOKEN", "ghp_your_token", "User")

Testing

SKILLSHARE_TEST_BINARY

Override the CLI binary path for integration tests.

SKILLSHARE_TEST_BINARY=/path/to/skillshare go test ./tests/integration

Default: bin/skillshare in project root


Usage Examples

Temporary override

# Single command
SKILLSHARE_CONFIG=/tmp/test-config.yaml skillshare status

# Multiple commands
export SKILLSHARE_CONFIG=/tmp/test-config.yaml
skillshare status
skillshare list
unset SKILLSHARE_CONFIG

Permanent setup (macOS/Linux)

Add to ~/.bashrc or ~/.zshrc:

export GITHUB_TOKEN="ghp_your_token_here"

Permanent setup (Windows)

[Environment]::SetEnvironmentVariable("GITHUB_TOKEN", "ghp_your_token", "User")

Summary

Variable Purpose Default
SKILLSHARE_CONFIG Config file path ~/.config/skillshare/config.yaml
XDG_CONFIG_HOME Base config directory ~/.config (Linux/macOS), %AppData% (Windows)
GITHUB_TOKEN GitHub API auth None
SKILLSHARE_TEST_BINARY Test binary path bin/skillshare