Environment Variables
Environment variables that affect Starweft behavior.
Overview
This is a list of environment variables that affect Starweft's behavior. Starweft is a P2P CLI tool that runs entirely on the local machine, so environment variables are set per process.
Environment Variables List
| Environment Variable | Type | Default | Description |
|---|---|---|---|
STARWEFT_GITHUB_TOKEN | string | - | GitHub API authentication token. Used by the publish github command. Highest priority |
GITHUB_TOKEN | string | - | GitHub API authentication token. Fallback when STARWEFT_GITHUB_TOKEN is not set |
GH_TOKEN | string | - | GitHub API authentication token. Fallback when the above two are not set |
STARWEFT_GITHUB_API_BASE_URL | string | https://api.github.com | Base URL for the GitHub API. Used when connecting to GitHub Enterprise, etc. |
STARWEFT_REGISTRY_SHARED_SECRET | string | - | Shared secret for registry authentication. Equivalent to the --shared-secret flag of registry serve |
RUST_LOG | string | info | Log filter. Fallback when -v/-q flags, --log-level, and the config log_level are not specified |
GitHub Token Priority
The starweft publish github command resolves the GitHub API token in the following priority order.
A Starweft-specific token. Use this when you want to avoid conflicts with other tools.
A general-purpose token widely used by GitHub Actions and other tools.
The token used by GitHub CLI (gh).
If none of these are set, an [E_GITHUB_TOKEN_MISSING] error occurs.
# Recommended: Set a Starweft-specific token
export STARWEFT_GITHUB_TOKEN="ghp_xxxxxxxxxxxx"
# Or reuse an existing GitHub CLI token
# (when using the output of gh auth token)
export GH_TOKEN=$(gh auth token)Registry Authentication
The starweft registry serve command can read the shared secret from the STARWEFT_REGISTRY_SHARED_SECRET environment variable. It can also be specified via the CLI flag (--shared-secret).
export STARWEFT_REGISTRY_SHARED_SECRET="your-secret-here"
starweft registry serve --bind 0.0.0.0:7777Using discovery.registry_shared_secret_env in config.toml allows client-side secrets to be passed via environment variables as well.
[discovery]
registry_url = "http://registry.local:7777"
registry_shared_secret_env = "MY_REGISTRY_SECRET"Log Level Control
Log level resolution follows this priority order.
-v for debug, -vv for trace. -q for warn, -qq for error. Highest priority.
Specified as starweft run --log-level debug.
The value from the configuration file. Only referenced during starweft run.
Fallback when all of the above are unspecified.
If none are set, the info level is used.
# Output debug logs for all commands
starweft -v status
# Output trace logs for the run command
starweft run --log-level trace
# Per-module control with RUST_LOG
RUST_LOG="starweft=debug,starweft_p2p=trace" starweft runGitHub Enterprise Support
Setting STARWEFT_GITHUB_API_BASE_URL allows you to use a GitHub Enterprise Server API endpoint.
export STARWEFT_GITHUB_API_BASE_URL="https://github.example.com/api/v3"
export STARWEFT_GITHUB_TOKEN="ghp_xxxxxxxxxxxx"
starweft publish github --repo org/repo --issue 42