Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,16 @@ docker run -it \
-e MINIO__BUCKET=destination-bucket \
-e MINIO__SECURE=1 \
-e MINIO__BUCKET_SUBPATH=SubFolder \
-e MINIO__PUBLIC_URL="https://my-minio-server.com" \
lutraconsulting/mergin-media-sync python3 media_sync_daemon.py
```

**Please note double underscore `__` is used to separate [config](config.yaml.default) group and item.**

The specification of `MINIO__BUCKET_SUBPATH` is optional and can be skipped if the files should be stored directly in `MINIO__BUCKET`.

The specification of `MINIO__PUBLIC_URL` is optional and can be used if the public URL to access files is different from the one specified in `MINIO__ENDPOINT` (e.g. when using a reverse proxy). If not specified, the value of `MINIO__ENDPOINT` will be used as the base URL for accessing files.

#### Using Google Drive backend
For setup instructions and more details, please refer to our [Google Drive guide](./docs/google-drive-setup.md).

Expand Down
1 change: 1 addition & 0 deletions config.yaml.default
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ minio:
secure: false
region:
bucket_subpath:
public_url:

google_drive:
service_account_file:
Expand Down
9 changes: 5 additions & 4 deletions drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,15 @@ def __init__(self, config):
self.client.make_bucket(self.bucket)

self.bucket_subpath = None
if hasattr(config.minio, "bucket_subpath"):
if config.minio.bucket_subpath:
self.bucket_subpath = config.minio.bucket_subpath
if hasattr(config.minio, "bucket_subpath") and config.minio.bucket_subpath:
self.bucket_subpath = config.minio.bucket_subpath

# construct base url for bucket
scheme = "https://" if config.as_bool("minio.secure") else "http://"

if config.minio.region and "amazonaws" in config.minio.endpoint.lower():
if hasattr(config.minio, "public_url") and config.minio.public_url:
self.base_url = config.minio.public_url.rstrip("/")
elif config.minio.region and "amazonaws" in config.minio.endpoint.lower():
self.base_url = (
f"{scheme}{self.bucket}.s3.{config.minio.region}.amazonaws.com"
)
Expand Down
1 change: 1 addition & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def setup_config():
"MINIO__BUCKET_SUBPATH": "",
"MINIO__SECURE": False,
"MINIO__REGION": "",
"MINIO__PUBLIC_URL": ""
}
)

Expand Down