These docs track the development branch (main). Latest release: v0.23.0.
Skip to content

Environment variables

CargoShip reads two families of environment variables: the standard AWS_* variables (via the AWS SDK credential chain) and its own CARGOSHIP_* settings.

Precedence

Settings resolve highest-priority first: command-line flags → environment variables → configuration file → built-in defaults. See Config files & precedence.

AWS & standard variables

CargoShip uses your standard AWS credential chain — the same one the AWS CLI uses. These are consumed by the AWS SDK, not read directly:

VariablePurpose
AWS_REGIONDefault region (override per command with --region).
AWS_PROFILENamed profile from ~/.aws/config / ~/.aws/credentials.
AWS_ACCESS_KEY_IDAccess key (when not using a profile or role).
AWS_SECRET_ACCESS_KEYSecret key.
AWS_SESSION_TOKENSession token for temporary credentials.
AWS_ENDPOINT_URLS3-compatible endpoint override (Wasabi, B2, MinIO).

CargoShip also honors a few standard tool/runtime variables:

VariablePurpose
EDITOR / VISUALEditor launched by cargoship config --edit.
GOMEMLIMIT / GOGCGo runtime memory/GC tuning, respected if set.
XDG_DATA_HOMEBase directory for restore-job state (see Restoring).

See AWS setup & credentials for the minimal IAM policy.

CargoShip variables

Few CARGOSHIP_* variables are read explicitly

For normal cargoship upload work, prefer flags or the configuration file — see the caveat on config-key variables below.

The CARGOSHIP_AGENT_*, CARGOSHIP_WATCH_PATHS, CARGOSHIP_DESTINATION, and CARGOSHIP_CONTROLLER_URL variables previously documented here were read only by the cargoship-launch binary, which was removed in v0.20.0 along with the controller (#340). Setting them now has no effect. CARGOSHIP_TLS_INSECURE went the same way: it relaxed certificate checks on the agent's outbound controller connection only, and nothing reads it now.

Distributed agents

VariablePurpose
AWS_PROFILECredential profile a ghost ship uses for S3.

Execution-context detection

Force the execution context instead of auto-detecting:

VariableEffect
CARGOSHIP_AGENT_MODERun as an agent.
CARGOSHIP_REPL_MODERun in REPL context.

Config-key variables (limited)

CargoShip enables viper's AutomaticEnv with a CARGOSHIP_ prefix, so some config keys can be set as environment variables (e.g. CARGOSHIP_LOG_LEVEL).

Nested keys don't reliably bind

There is no env-key replacer configured, so nested config keys such as upload.chunk_size do not map cleanly to CARGOSHIP_UPLOAD_CHUNK_SIZE. Treat only the explicitly-listed variables above as guaranteed. For anything under a config section, use the configuration file or a command-line flag instead.

See also