Exemplo n.º 1
0
def get_app(config):
    """ Init the webdav app """
    mongo_client = MongoClient(
        host=config.get('mongo_opt', {}).get('host', 'localhost'))
    database = mongo_client[config.get('mongo_opt',
                                       {}).get('database', 'INGInious')]

    # Create the FS provider
    if "tasks_directory" not in config:
        raise RuntimeError(
            "WebDav access is only supported if INGInious is using a local filesystem to access tasks"
        )

    fs_provider = LocalFSProvider(config["tasks_directory"])
    course_factory, task_factory = create_factories(fs_provider, {}, {}, None)
    user_manager = UserManager(database, config.get('superadmins', []))

    config = dict(wsgidav_app.DEFAULT_CONFIG)
    config["provider_mapping"] = {
        "/": INGIniousFilesystemProvider(course_factory, task_factory)
    }
    config["http_authenticator"]["domain_controller"] = get_dc(
        course_factory, user_manager, fs_provider)
    config["verbose"] = 0

    app = wsgidav_app.WsgiDAVApp(config)
    util.init_logging(config)

    return app
Exemplo n.º 2
0
def App(**settings):
    """A WSGI app that supports WebDAV."""

    config = dict(wsgidav_app.DEFAULT_CONFIG, **settings)
    return wsgidav_app.WsgiDAVApp(config)
Exemplo n.º 3
0
insecure = False  # Set to True to disable SSL certificate validation

config = wsgidav_app.DEFAULT_CONFIG.copy()
config.update({
    "provider_mapping": {
        "": swiftdav.SwiftProvider()
    },
    "verbose":
    1,
    "propsmanager":
    True,
    "locksmanager":
    True,
    "acceptbasic":
    True,
    "acceptdigest":
    False,
    "defaultdigest":
    False,
    "domaincontroller":
    swiftdav.WsgiDAVDomainController(proxy,
                                     insecure,
                                     auth_version=auth_version)
})
app = wsgidav_app.WsgiDAVApp(config)

waitress.serve(app,
               host="0.0.0.0",
               port=8000,
               max_request_body_size=5 * 1024 * 1024 * 1024)