-
Notifications
You must be signed in to change notification settings - Fork 15
/
__init__.py
54 lines (42 loc) · 1.96 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018, 2019 Esteban J. G. Gabancho.
#
# Invenio-S3 is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""S3 file storage support for Invenio.
To use this module together with Invenio-Files-Rest there are a few things you
need to keep in mind.
The storage factory configuration variable, ``FILES_REST_STORAGE_FACTORY``
needs to be set to ``'invenio_s3.s3fs_storage_factory'`` importable string.
We think the best way to use this module is to have one `Localtion
<https://invenio-files-rest.readthedocs.io/en/latest/api.html#module-invenio_files_rest.models>`_
for each S3 bucket. This is just for simplicity, it can used however needed.
When creating a new location which will use the S3 API, the URI needs to start
with ``s3://``, for example
``invenio files location S3_default s3://myserver.com/b1 --default`` will
create a new location, set it as default location for your instance and use the
bucket ``b1``. For more information about this command check
`Invenio-Files-Rest <https://invenio-files-rest.readthedocs.io/en/latest/>`_
documentation.
Then, there are a few configuration variables that need to be set on your
instance, like the endpoint, the access key and the secret access key, see a
more detailed description in :any:`configuration`.
.. note::
This module doesn't create S3 buckets automatically, so before starting they
need to be created.
You might also want to set the correct `CORS configuration
<https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html>`_ so files can
be used by your interface for things like previewing a PDF with some
Javascript library.
"""
from __future__ import absolute_import, print_function
from .ext import InvenioS3
from .storage import S3FSFileStorage, s3fs_storage_factory
from .version import __version__
__all__ = (
'__version__',
'InvenioS3',
'S3FSFileStorage',
's3fs_storage_factory',
)