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_BUCKETEndpoint:
R2_ENDPOINTorR2_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 fromR2_BUCKET)-e/--endpoint: Endpoint URL (default fromR2_ENDPOINTorR2_ENDPOINT_URL)--region: Optional explicit region; by defaultR2Clientreads env
- s6.app.r2._common.make_client(bucket: str, endpoint: str, region: str | None = None) R2Client
Construct an
R2Clientfrom explicit values.access_key_idandsecret_access_keyare resolved from environment by the client itself; sees6.utils.r2.R2Clientfor 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
SystemExitif missing.