Skip to content

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 VariableTypeDefaultDescription
STARWEFT_GITHUB_TOKENstring-GitHub API authentication token. Used by the publish github command. Highest priority
GITHUB_TOKENstring-GitHub API authentication token. Fallback when STARWEFT_GITHUB_TOKEN is not set
GH_TOKENstring-GitHub API authentication token. Fallback when the above two are not set
STARWEFT_GITHUB_API_BASE_URLstringhttps://api.github.comBase URL for the GitHub API. Used when connecting to GitHub Enterprise, etc.
STARWEFT_REGISTRY_SHARED_SECRETstring-Shared secret for registry authentication. Equivalent to the --shared-secret flag of registry serve
RUST_LOGstringinfoLog 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.

2

A Starweft-specific token. Use this when you want to avoid conflicts with other tools.

4

A general-purpose token widely used by GitHub Actions and other tools.

6

The token used by GitHub CLI (gh).

If none of these are set, an [E_GITHUB_TOKEN_MISSING] error occurs.

bash
# 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).

bash
export STARWEFT_REGISTRY_SHARED_SECRET="your-secret-here"
starweft registry serve --bind 0.0.0.0:7777

Using discovery.registry_shared_secret_env in config.toml allows client-side secrets to be passed via environment variables as well.

toml
[discovery]
registry_url = "http://registry.local:7777"
registry_shared_secret_env = "MY_REGISTRY_SECRET"

Log Level Control

Log level resolution follows this priority order.

2

-v for debug, -vv for trace. -q for warn, -qq for error. Highest priority.

4

Specified as starweft run --log-level debug.

6

The value from the configuration file. Only referenced during starweft run.

8

Fallback when all of the above are unspecified.

10

If none are set, the info level is used.

bash
# 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 run

GitHub Enterprise Support

Setting STARWEFT_GITHUB_API_BASE_URL allows you to use a GitHub Enterprise Server API endpoint.

bash
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