Skip to content

Configuration schema

CargoShip reads settings from a YAML configuration file so you don't have to repeat flags on every command. Anything in the file can still be overridden by an environment variable or a command-line flag — see Config files & precedence.

bash
cargoship config --generate            # write an annotated example config
cargoship config --show                # print the resolved configuration
cargoship config --validate            # validate the active config
cargoship config --validate-detailed   # also check AWS connectivity & bucket access

File location

Config files are discovered by name (.cargoship.yaml) in this order:

  1. $HOME/.cargoship.yaml
  2. $HOME/.config/cargoship/.cargoship.yaml
  3. ./.cargoship.yaml (current directory)

The interactive setup wizard (cargoship setup) writes ~/.cargoship.yaml for you. You can also point at any file with --file.

Schema

The file has eight top-level sections. Defaults below are what CargoShip uses when a key is omitted.

aws

KeyTypeDefaultNotes
regionstringus-west-2Required. Default region for S3 operations.
profilestringNamed AWS profile.
access_key_idstringPrefer the credential chain; avoid committing keys.
secret_access_keystring
session_tokenstringFor temporary credentials.
s3_endpointstringS3-compatible endpoint override (Wasabi, B2, MinIO).
use_path_styleboolfalsePath-style S3 addressing (needed by some S3-compatible providers).
max_retriesint3SDK retry attempts.
retry_max_delayduration30sMax backoff between retries.
request_timeoutduration5mPer-request timeout.

storage

KeyTypeDefaultNotes
default_bucketstringUsed when a command omits the bucket.
default_storage_classstringINTELLIGENT_TIERINGMust be one of the valid classes (see security).
kms_key_idstringKMS key for SSE-KMS / manifest encryption.
sse_encryptionbooltrueServer-side encryption on by default.
object_taggingmapTags applied to uploaded objects.
metadata_directivestringREPLACES3 metadata directive.

upload

KeyTypeDefaultNotes
max_concurrencyint8Parallel upload workers (1–100).
chunk_sizesize16MBTarget chunk size.
enable_adaptive_sizingbooltrueAuto-tune chunk size to the workload.
max_prefixesint8Upper bound on parallel S3 prefixes.
prefix_patternstringhashPrefix distribution pattern.
compression_typestringzstdArchive compression algorithm.
compression_levelint3Zstandard level (1–22).
checksum_algorithmstringSHA256Integrity checksum.
memory_limitsizeOptional cap on pipeline memory.

metrics

KeyTypeDefaultNotes
enabledbooltruePublish CloudWatch metrics.
namespacestringCargoShip/ProductionRequired when enabled.
flush_intervalduration30sHow often metrics are flushed.
batch_sizeint20Metrics per batch.
regionstringDefaults to aws.region.
dry_runboolfalseCompute but don't publish metrics.

logging

KeyTypeDefaultNotes
levelstringinfoOne of debug, info, warn, error.
structuredboolfalseJSON structured logs.
timestampbooltrueInclude timestamps.
callerboolfalseInclude caller file/line.
outputstringLog destination (default stderr).

security

KeyTypeDefaultNotes
require_encryptionboolfalseRefuse unencrypted uploads.
allowed_regionslistRestrict which regions may be used.
allowed_storage_classeslistall six (below)Restrict selectable classes.
max_file_sizesizeReject files larger than this.
blocked_extensionslistReject these file extensions.

Valid storage classes: STANDARD, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE.

cargohold

Sharding subsystem — see Multi-prefix sharding.

KeyTypeDefaultNotes
enablebooltrueUse CargoHold sharding.
shard_countint10Shards (1–100). The upload command defaults to adaptive (--shard-count 0).
shard_strategystringhashOne of round-robin, hash, size, type, directory.
compression_levelint3Zstandard level (1–22).

magika

AI file-type detection — see Magika AI file detection.

KeyTypeDefaultNotes
enabledboolfalseOpt-in; requires pip install magika.
binary_pathstringAuto-discovered on PATH if empty.
batch_sizeint100Files per batch (1–10000).
timeoutduration30sPer-batch timeout.
enable_cachebooltrueCache detection results.
use_mime_typeboolfalseReport MIME type instead of content label.
include_scoresboolfalseInclude confidence scores.

Validation

cargoship config --validate enforces: aws.region is present; storage.default_storage_class is one of the six valid classes; upload.max_concurrency is 1–100; metrics.namespace is set when metrics are enabled; logging.level is one of debug/info/warn/error; cargohold.shard_count is 1–100 and shard_strategy is one of hash/size/type/directory; cargohold.compression_level is 1–22; magika.batch_size is 1–10000 and magika.timeout parses as a duration.

TIP

cargoship config --generate writes a fully-commented example with every section, so you can start from a working file rather than build one by hand.

See also