app: add max_upload_size configuration option
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
733cf0afac
commit
8b08b03fbf
@ -154,6 +154,8 @@ port: 7125
|
|||||||
klippy_address: /tmp/klippy_uds
|
klippy_address: /tmp/klippy_uds
|
||||||
# The address of Unix Domain Socket used to communicate with Klippy. Default
|
# The address of Unix Domain Socket used to communicate with Klippy. Default
|
||||||
# is /tmp/klippy_uds
|
# is /tmp/klippy_uds
|
||||||
|
max_upload_size: 200
|
||||||
|
# The maximum size allowed for a file upload. Default is 200 MiB.
|
||||||
enable_debug_logging: True
|
enable_debug_logging: True
|
||||||
# When set to True Moonraker will log in verbose mode. During this stage
|
# When set to True Moonraker will log in verbose mode. During this stage
|
||||||
# of development the default is True. In the future this will change.
|
# of development the default is True. In the future this will change.
|
||||||
|
@ -16,9 +16,6 @@ from websockets import WebsocketManager, WebSocket
|
|||||||
from authorization import AuthorizedRequestHandler, AuthorizedFileHandler
|
from authorization import AuthorizedRequestHandler, AuthorizedFileHandler
|
||||||
from authorization import Authorization
|
from authorization import Authorization
|
||||||
|
|
||||||
# Max Upload Size of 200MB
|
|
||||||
MAX_UPLOAD_SIZE = 200 * 1024 * 1024
|
|
||||||
|
|
||||||
# These endpoints are reserved for klippy/server communication only and are
|
# These endpoints are reserved for klippy/server communication only and are
|
||||||
# not exposed via http or the websocket
|
# not exposed via http or the websocket
|
||||||
RESERVED_ENDPOINTS = [
|
RESERVED_ENDPOINTS = [
|
||||||
@ -99,6 +96,8 @@ class MoonrakerApp:
|
|||||||
self.tornado_server = None
|
self.tornado_server = None
|
||||||
self.api_cache = {}
|
self.api_cache = {}
|
||||||
self.registered_base_handlers = []
|
self.registered_base_handlers = []
|
||||||
|
self.max_upload_size = config.getint('max_upload_size', 200)
|
||||||
|
self.max_upload_size *= 1024 * 1024
|
||||||
|
|
||||||
# Set Up Websocket and Authorization Managers
|
# Set Up Websocket and Authorization Managers
|
||||||
self.wsm = WebsocketManager(self.server)
|
self.wsm = WebsocketManager(self.server)
|
||||||
@ -107,7 +106,6 @@ class MoonrakerApp:
|
|||||||
mimetypes.add_type('text/plain', '.log')
|
mimetypes.add_type('text/plain', '.log')
|
||||||
mimetypes.add_type('text/plain', '.gcode')
|
mimetypes.add_type('text/plain', '.gcode')
|
||||||
mimetypes.add_type('text/plain', '.cfg')
|
mimetypes.add_type('text/plain', '.cfg')
|
||||||
|
|
||||||
debug = config.getboolean('enable_debug_logging', True)
|
debug = config.getboolean('enable_debug_logging', True)
|
||||||
enable_cors = config.getboolean('enable_cors', False)
|
enable_cors = config.getboolean('enable_cors', False)
|
||||||
|
|
||||||
@ -135,7 +133,7 @@ class MoonrakerApp:
|
|||||||
|
|
||||||
def listen(self, host, port):
|
def listen(self, host, port):
|
||||||
self.tornado_server = self.app.listen(
|
self.tornado_server = self.app.listen(
|
||||||
port, address=host, max_body_size=MAX_UPLOAD_SIZE,
|
port, address=host, max_body_size=self.max_upload_size,
|
||||||
xheaders=True)
|
xheaders=True)
|
||||||
|
|
||||||
async def close(self):
|
async def close(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user