CLI guide
GitHub

Configuration

The CLI has no configuration file. Flags and environment variables set all values. A flag takes priority over its variable.

Env var Flag Default Sets
SOURCE_PROXY_URL --proxy-url https://data.source.coop The environment: the data proxy, and the session and credentials to use
SOURCE_API_URL --api-url https://source.coop The source.coop site whose API (/api/v1) commands use
SOURCE_TOKEN A bearer token for the API, used instead of the session's
SOURCE_ROLE_ARN --role-arn _default The role for creds, auth login, status and logout
SOURCE_OIDC_ISSUER --issuer https://auth.source.coop Where auth login signs in
SOURCE_OIDC_CLIENT_ID --client-id source.coop's The OAuth2 client for auth login
SOURCE_API_AUDIENCE --audience https://source.coop The audience of the API access token that auth login requests
SOURCE_REFRESH_TOKEN_LIFETIME 30d The refresh-token lifetime that auth status assumes, for example 720h or 14d
SOURCE_PROMPT_DISABLED If set to any value, the CLI never asks questions
SOURCE_PAGER, PAGER --no-pager less -FRX The pager for lists on a terminal
VISUAL, EDITOR The editor that Ctrl+E opens for long text
GH_TOKEN, GITHUB_TOKEN Lets the CLI ask GitHub about the workflows of a private repository
NO_COLOR, CLICOLOR=0 No color, also on a terminal

.env.staging in this repository sets the values for staging. Run source .env.staging before a command, or use a subshell as in Multiple environments.

To set up the OAuth2 client for another deployment of source.coop, see CONTRIBUTING.md.

Multiple environments (for example, staging)

Each proxy host is a different environment, with its own session and credentials. Thus you can be signed in to production and staging at the same time:

source-coop auth login
( source .env.staging && source-coop auth login )

An AWS profile for a different environment must use --proxy-url. If it does not, it gets production credentials:

[profile source-coop]
credential_process = source-coop creds
endpoint_url = https://data.source.coop

[profile source-coop-staging]
credential_process = source-coop creds --proxy-url https://data.staging.source.coop
endpoint_url = https://data.staging.source.coop

Sign-in options

Flag Env var Default Description
--issuer SOURCE_OIDC_ISSUER https://auth.source.coop OIDC issuer URL
--client-id SOURCE_OIDC_CLIENT_ID 197e20e7-... OAuth2 client ID
--proxy-url SOURCE_PROXY_URL https://data.source.coop S3 proxy URL for STS. Also selects the environment of the session.
--role-arn SOURCE_ROLE_ARN _default Role ARN to assume
--format credential-process Output format: credential-process, env or aws-credentials
--profile source-coop Profile name for --format aws-credentials
--duration Session duration, for example 3600, 90s, 5m, 12h, 1d (a number alone is seconds)
--scope openid offline_access OAuth2 scopes. offline_access lets creds renew credentials.
--audience SOURCE_API_AUDIENCE https://source.coop Audience of the API access token. If empty, the CLI requests none, and only creds works.
--port 0 (random) Local callback port
--no-cache Print the credentials and keep nothing