Skip to main content

Minio Storage Driver for Masonite

Project description

Project description

What is Minio-Driver? It's an extra storage driver for masonite. It adds support for minio server.

Setup

Install package using pip:

pip install minio-driver

Add provider inside config/providers.py.

from minio_driver.MinioProvider import MinioProvider

PROVIDERS = [
    ...,
    # Application Providers
    MinioProvider,
]

Storage Config

Add following configuration inside config/storage.py after "disk": {"location": "storage/uploads"},

"minio": {
    "endpoint": env("MINIO_URL", "https://min.io"),
    "client": env("MINIO_CLIENT", "AxJz..."),
    "secret": env("MINIO_SECRET", "HkZj..."),
    "bucket": env("MINIO_BUCKET", "s3bucket"),
},

Add following keys in .env.

MINIO_CLIENT=
MINIO_SECRET=
MINIO_BUCKET=
MINIO_URL=

Example

from masonite.request import Request
from masonite import Upload

def your_function(request: Request, upload: Upload):
    file = request.input('file')
    key = upload.store(file)
    file_url = upload.url(key, 3600) # url accepts file key and the expiry time for signed url
    return file_url

Enjoy ;)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minio_driver-0.0.9.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

minio_driver-0.0.9-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page