s6.app.r2._commonΒΆ

Shared helpers for R2 CLI subcommands.

Provides argument wiring and a small factory to build s6.utils.r2.R2Client from CLI options and environment variables.

Environment defaultsΒΆ

  • Bucket: R2_BUCKET

  • Endpoint: R2_ENDPOINT or R2_ENDPOINT_URL

Credentials and region are handled by s6.utils.r2.R2Client using the standard env vars (R2_/AWS_). These helpers keep command scripts lean.

s6.app.r2._common.add_r2_client_args(parser: ArgumentParser) None

Add common R2 client options to parser.

OptionsΒΆ

  • -b/--bucket: Bucket name (default from R2_BUCKET)

  • -e/--endpoint: Endpoint URL (default from R2_ENDPOINT or R2_ENDPOINT_URL)

  • --region: Optional explicit region; by default R2Client reads env

s6.app.r2._common.make_client(bucket: str, endpoint: str, region: str | None = None) R2Client

Construct an R2Client from explicit values.

access_key_id and secret_access_key are resolved from environment by the client itself; see s6.utils.r2.R2Client for details.

s6.app.r2._common.require_bucket_endpoint(args: Namespace) tuple[str, str]

Validate bucket/endpoint presence and return them.

Exits with a helpful message via SystemExit if missing.