Minio Storage Driver for Masonite
Project description
Project description
What is Minio-Driver?
It's an extra storage driver support for Minio in masonite 4.
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/filesystem.py after "s3": {...},
"minio": {
"driver": "minio",
"client": env("MINIO_CLIENT"),
"secret": env("MINIO_SECRET"),
"bucket": env("MINIO_BUCKET"),
"path": env("MINIO_ENDPOINT"),
},
Add following keys in .env
.
MINIO_CLIENT=
MINIO_SECRET=
MINIO_BUCKET=
MINIO_ENDPOINT=
Update the storage driver value to minio
in .env
STORAGE_DRIVER=minio
Example
from masonite.controllers import Controller
from masonite.filesystem import Storage
from masonite.request import Request
class YourController(Controller):
def your_function(self, request: Request, storage: Storage):
file = request.input('file')
# storing file
path = storage.disk("minio").put_file('your_file_directory', file)
# getting file_url from storage
file_url = storage.disk("minio").get_secure_url(path)
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.1.5.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for minio_driver-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 898767bc0c5c84ae78cfa70cff8faf783aee37d7991542fc3a71ea1879b1f6f9 |
|
MD5 | 8e41d32d997a8a696040d2dd9c71a1c9 |
|
BLAKE2b-256 | 258c0bfe13a453fcd236df2b3a68f2b0920d33cbc02e0077a691cd693866b7b5 |