Configure Cloud Storage¶
This guide shows how to configure cloud storage providers for fsspeckit using environment variables and structured options classes. For the provider configuration reference, see Storage Options.
Cloud providers require their respective extra. See the
extras matrix: aws for S3, gcp for
Google Cloud Storage, and azure for Azure Blob/Data Lake. GitHub and GitLab
require no extra.
Environment-based configuration¶
The recommended approach for production is to load configuration from standard
environment variables. The module-level from_env(protocol) factory reads the
provider's conventional variables:
Each options class also has a from_env() classmethod that reads the same
variables for its provider:
Manual configuration¶
For development or when you need explicit control, construct the options class
directly and pass it to filesystem():
You can also call to_filesystem() on an options object to build the
filesystem directly. Use to_dict() when you want a kwargs mapping to pass to
filesystem() yourself; use to_filesystem() to build the filesystem from
the options object in one step.
Git providers¶
GitHub and GitLab filesystems need no extra. They use a token for authentication:
Choosing a provider from a URI¶
fsspeckit does not derive cloud credentials from a URI. Configure each
provider explicitly with its options class or from_env() as shown above, and
pass the resulting options to filesystem(). To pick a provider
programmatically from a URI's scheme, infer_protocol_from_uri() returns just
the protocol string:
For the full list of option classes and factory helpers, see Storage Options.
Merging configurations¶
merge_storage_options(*options, overwrite=True) combines several sources into
one. Later sources win when overwrite is true (the default), which lets you
layer a base configuration with per-environment overrides:
Security best practices¶
- Store credentials in environment variables or a secrets manager, never in source. Prefer IAM roles or workload identity over long-lived access keys.
- Use
from_env()so secrets never appear in code. - Redact secrets in logs with
scrub_credentials()fromfsspeckit.common.
Related documentation¶
- Storage Options - provider classes and factory helpers.
- Work with Filesystems - filesystem creation, caching, and extended I/O.
- Installation - the extras matrix.