| 1 |
""" |
| 2 |
IMPORTANT: |
| 3 |
|
| 4 |
The config is only loaded at startup time of the app, so if you change it, |
| 5 |
you need to restart the wsgi app process(es) to make it load the updated |
| 6 |
config. |
| 7 |
""" |
| 8 |
|
| 9 |
#: name of this site (put YOUR bepasty fqdn here) |
| 10 |
SITENAME = 'bepasty.example.org' |
| 11 |
|
| 12 |
#: base URL path of app (if not served on root URL, but e.g. on http://example.org/bepasty ). |
| 13 |
#: setting this to a non-None value will activate the PrefixMiddleware that splits PATH_INFO |
| 14 |
#: into SCRIPT_NAME (== APP_BASE_PATH) and the rest of PATH_INFO. |
| 15 |
APP_BASE_PATH = None # '/bepasty' |
| 16 |
|
| 17 |
#: Whether files are automatically locked after upload. |
| 18 |
#: |
| 19 |
#: If you want to require admin approval and manual unlocking for each |
| 20 |
#: uploaded file, set this to True. |
| 21 |
UPLOAD_LOCKED = False |
| 22 |
|
| 23 |
#: The site admin can set some maximum allowed file size he wants to |
| 24 |
#: accept here. This is the maximum size an uploaded file may have. |
| 25 |
MAX_ALLOWED_FILE_SIZE = 5 * 1000 * 1000 * 1000 |
| 26 |
|
| 27 |
#: The maximum http request body size. |
| 28 |
#: This is an information given to rest api clients so they can adjust |
| 29 |
#: their chunk size accordingly. |
| 30 |
#: |
| 31 |
#: This needs to be in sync with (or at least not beyond) the web server |
| 32 |
#: settings: |
| 33 |
#: apache: LimitRequestBody 1048576 # apache default is 0 (unlimited) |
| 34 |
#: nginx: client_max_body_size 1m; # nginx default (== 1048576) |
| 35 |
MAX_BODY_SIZE = 1 * 1024 * 1024 - 8192 # 8kiB safety margin, issue #155 |
| 36 |
|
| 37 |
#: Setup maximum file sizes for specific content-types. If an item is |
| 38 |
#: beyond the limit set for its type, it will not be rendered, but just |
| 39 |
#: offered for download. Lookup within MAX_RENDER_SIZE is done by |
| 40 |
#: first-match and it is automatically sorted for longer content-type- |
| 41 |
#: prefixes first. |
| 42 |
#: |
| 43 |
#: Format of entries: content-type-prefix: max_size |
| 44 |
MAX_RENDER_SIZE = { |
| 45 |
# each list entry has 38 bytes, do not render > 1000 items |
| 46 |
'text/x-bepasty-list': 1000 * 38, |
| 47 |
# stuff rendered with syntax highlighting (expensive for server and |
| 48 |
# client) and also used for other text/* types as we use same code to |
| 49 |
# get a (non-highlighted) display with line numbers: |
| 50 |
'HIGHLIGHT_TYPES': 100 * 1000, |
| 51 |
# the in-browser pdf reader is sometimes rather slow and should |
| 52 |
# rather not be used for big PDFs: |
| 53 |
'application/pdf': 10 * 1000 * 1000, |
| 54 |
'application/x-pdf': 10 * 1000 * 1000, |
| 55 |
# images / audio / video can be rather big, we do not process them: |
| 56 |
'image/': 10 * 1000 * 1000, |
| 57 |
'audio/': 1 * 1000 * 1000 * 1000, |
| 58 |
'video/': 5 * 1000 * 1000 * 1000, |
| 59 |
# DEFAULT - matches everything not matched otherwise. |
| 60 |
# As we have catched everything we are able to render already, |
| 61 |
# this maybe should be a medium size, just for the case we forget |
| 62 |
# something: |
| 63 |
'': 1 * 1000 * 1000, |
| 64 |
} |
| 65 |
|
| 66 |
#: Define storage backend, choose from: |
| 67 |
#: |
| 68 |
#: - 'filesystem' |
| 69 |
#: |
| 70 |
STORAGE = 'filesystem' |
| 71 |
|
| 72 |
#: Filesystem storage path |
| 73 |
STORAGE_FILESYSTEM_DIRECTORY = '/srv/bepasty/storage' |
| 74 |
|
| 75 |
#: server secret key needed for safe session cookies. |
| 76 |
#: you must set a very long, very random, very secret string here, |
| 77 |
#: otherwise bepasty will not work (and crash when trying to log in)! |
| 78 |
SECRET_KEY = '' |
| 79 |
|
| 80 |
#: transmit cookie only over https (if you use http, set this to False) |
| 81 |
SESSION_COOKIE_SECURE = True |
| 82 |
#: use a permanent session (True, cookie will expire after the given |
| 83 |
#: time, see below) or not (False, cookie will get removed when browser |
| 84 |
#: is closed) |
| 85 |
PERMANENT_SESSION = False |
| 86 |
#: lifetime of the permanent session (in seconds) |
| 87 |
PERMANENT_SESSION_LIFETIME = 31 * 24 * 3600 |
| 88 |
|
| 89 |
#: Bepasty does **not** use the usual user/password scheme, but **only** |
| 90 |
#: uses passwords (or passphrases - we'll call both "a secret" below) as |
| 91 |
#: log-in credentials - there are no separate user names. |
| 92 |
#: |
| 93 |
#: People who log-in using such a secret may get more permissions than |
| 94 |
#: those who do not log-in (who just get DEFAULT_PERMISSIONS). |
| 95 |
#: |
| 96 |
#: Depending on the secret used to log-in, they will get the permissions |
| 97 |
#: configured here, see below. |
| 98 |
#: |
| 99 |
#: You can use same secret / same permissions for all privileged users or |
| 100 |
#: set up different secrets / different permissions for each user. |
| 101 |
#: |
| 102 |
#: If you want to be able to revoke permissions for some user / some group |
| 103 |
#: of users, it might be a good idea to remember to whom you gave which |
| 104 |
#: secret (and also handle it in a rather fine-grained way). |
| 105 |
#: |
| 106 |
#: PERMISSIONS is a dict that maps secrets to permissions, use it like: |
| 107 |
#: |
| 108 |
#: :: |
| 109 |
#: |
| 110 |
#: PERMISSIONS = { |
| 111 |
#: 'myadminsecret_1.21d-3!wdar34': 'admin,list,create,read,delete', |
| 112 |
#: 'uploadersecret_rtghtrbrrrfsd': 'create,read', |
| 113 |
#: 'joe_doe_89359299887711335537': 'create,read,delete', |
| 114 |
#: } |
| 115 |
PERMISSIONS = { |
| 116 |
# 'foo': 'admin,list,create,read,delete', |
| 117 |
} |
| 118 |
|
| 119 |
#: not-logged-in users get these permissions - |
| 120 |
#: usually they are either no permissions ('') or read-only ('read'). |
| 121 |
DEFAULT_PERMISSIONS = '' |