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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for minio_driver-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8e66e6509edbd76a9fbdc8168ef8d30e358ee252f91d25093d68d667d367cbc |
|
MD5 | 6f67bf4de8c3af3dd8ce308934731d46 |
|
BLAKE2b-256 | 38b5030e71ee8b9df63c1749cef0b015ded2d9dac267be4b5587f3b188c90c05 |