Skip to content

Commit

Permalink
Add secure argument
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw committed Sep 4, 2024
1 parent 2284cfc commit 9faf954
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions audbackend/core/backend/minio.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ class Minio(Base):
authentication: username, password / access key, secret key token tuple.
If ``None``,
it requests it by calling :meth:`get_authentication`
secure: if ``None``,
it looks in the config file for it,
compare :meth:`get_config`.
If it cannot find a matching entry,
it defaults to ``True``.
Needs to be ``True``
when using TLS for the connection,
and ``False`` otherwise,
e.g. when using a `local MinIO server`_.
.. _local MinIO server: https://min.io/docs/minio/container/index.html
Examples:
>>> host = "play.min.io" # playground provided by https://min.io
Expand All @@ -44,20 +55,23 @@ def __init__(
repository: str,
*,
authentication: typing.Tuple[str, str] = None,
secure: bool = None,
):
super().__init__(host, repository, authentication=authentication)

if authentication is None:
self.authentication = self.get_authentication(host)

config = self.get_config(host)
if secure is None:
config = self.get_config(host)
secure = config.get("secure", True)

# Open MinIO client
self._client = minio.Minio(
host,
access_key=self.authentication[0],
secret_key=self.authentication[1],
secure=config.get("secure", True),
secure=secure,
)

@classmethod
Expand Down

0 comments on commit 9faf954

Please sign in to comment.