-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Problem Description
I'm trying to build a simple S3 caching web server using this library with aiohttp. My goal is to avoid the potential performance hit from using boto3 and only need basic S3 GET and PUT operations with a third-party S3 provider (not AWS).
The credentials initialization in credentials.py works well for mimicking boto3's configuration handling, but I'm facing an issue with the following logic:
try:
credentials_paths_exists = (
credentials_path.exists() and config_path.exists()
)
except OSError:
credentials_paths_exists = False
This code causes an issue because it expects both ~/.aws/credentials and ~/.aws/config to exist. However, in my case:
-
I may not have a
~/.aws/credentialsfile, as I useURLCredentials()or environment variables for credentials, while configuration (e.g., region) is in~/.aws/config. -
I may not have a
~/.aws/configfile, since I specify the S3 endpoint directly in my app's configuration, and provide other settings (like the default region) via environment variables (I also use Docker secrets for~/.aws/credentials).
This causes the following error to be raised: raise ValueError(f"Credentials {credentials!r} is incomplete")
Expected Behavior
I don’t believe both ~/.aws/credentials and ~/.aws/config should be required in all cases, especially for non-AWS S3 providers. In my case, I would like to bypass this check and rely solely on the initialization routine in the library, which works for interacting with third-party S3 providers.
Proposed Solution
It would be helpful if the library could handle cases where either ~/.aws/credentials or ~/.aws/config are missing, without raising an error. Alternatively, I could provide a configuration flag or a way to bypass this check.
Since rewriting the entire initialization logic in my app isn't ideal, I believe this is an issue worth addressing.