Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 Storage Using Minio #34

Open
mgiannoni opened this issue Sep 1, 2023 · 0 comments
Open

S3 Storage Using Minio #34

mgiannoni opened this issue Sep 1, 2023 · 0 comments

Comments

@mgiannoni
Copy link
Contributor

S3 Storage Using Minio

The Boto3 Client attempts to use AWS Session Credentials by default. Apparently something like this in "pywis-pubsub-config.yml" is insufficient:

storage:
type: S3
options:
url: http://minio:minio123@localhost:9000
bucket: wis2box-cache

pywis-pubsub]$ git diff pywis_pubsub/storage.py
diff --git a/pywis_pubsub/storage.py b/pywis_pubsub/storage.py
index 3411516..e073432 100644
--- a/pywis_pubsub/storage.py
+++ b/pywis_pubsub/storage.py
@@ -94,13 +94,15 @@ class S3(Storage):
s3_url = self.options['url']
self.s3_bucket = self.options['bucket']
- s3_client = boto3.client('s3', endpoint_url=s3_url)
+ s3_client = boto3.client('s3', endpoint_url=s3_url,
+ aws_access_key_id=self.options['username'],
+ aws_secret_access_key=self.options['password'])
return s3_client
def save(self, data: bytes, filename: Path) -> bool:
- s3_client = self._get_client()
+ s3_client = self._get_client(self)
try:
s3_client.put_object(Body=data, Bucket=self.s3_bucket,
@@ -115,7 +117,7 @@ class S3(Storage):
def delete(self, filename: Path) -> bool:
- s3_client = self._get_client()
+ s3_client = self._get_client(self)
LOGGER.debug(f'Deleting object {filename}')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant