Configuration¶
This document describes the configuration options of a WsgiDAV server.
The WsgiDAVApp
object is configured by passing
a Python dict
with distinct options, that define
Server options (hostname, port, SSL cert, …)
List of share-name / WebDAV provider mappings
Optional list of users for authentication
Optional custom DAV providers (i.e. other than
FilesystemProvider
)Optional custom lock manager, property manager and domain controller
Advanced debugging options
(and more)
This section shows the available options and defaults:
1# -*- coding: utf-8 -*-
2# (c) 2009-2022 Martin Wendt and contributors; see WsgiDAV https://github.com/mar10/wsgidav
3# Original PyFileServer (c) 2005 Ho Chun Wei.
4# Licensed under the MIT license:
5# http://www.opensource.org/licenses/mit-license.php
6r"""
7::
8
9 _ __ _ ___ ___ _ __
10 | | /| / /__ ___ (_) _ \/ _ | | / /
11 | |/ |/ (_-</ _ `/ / // / __ | |/ /
12 |__/|__/___/\_, /_/____/_/ |_|___/
13 /___/
14
15Default confguration.
16"""
17# from wsgidav.mw.debug_filter import WsgiDavDebugFilter
18from wsgidav.dir_browser import WsgiDavDirBrowser
19from wsgidav.error_printer import ErrorPrinter
20from wsgidav.http_authenticator import HTTPAuthenticator
21from wsgidav.mw.cors import Cors
22from wsgidav.request_resolver import RequestResolver
23
24__docformat__ = "reStructuredText"
25
26# Use these settings, if config file does not define them (or is totally missing)
27DEFAULT_VERBOSE = 3
28DEFAULT_LOGGER_DATE_FORMAT = "%H:%M:%S"
29DEFAULT_LOGGER_FORMAT = "%(asctime)s.%(msecs)03d - %(levelname)-8s: %(message)s"
30
31DEFAULT_CONFIG = {
32 "server": "cheroot",
33 "server_args": {},
34 "host": "localhost",
35 "port": 8080,
36 "mount_path": None, # Application root, e.g. <mount_path>/<share_name>/<res_path>
37 "provider_mapping": {},
38 "add_header_MS_Author_Via": True,
39 "hotfixes": {
40 "emulate_win32_lastmod": False, # True: support Win32LastModifiedTime
41 "re_encode_path_info": True, # (See issue #73)
42 "unquote_path_info": False, # (See issue #8, #228)
43 # "treat_root_options_as_asterisk": False, # Hotfix for WinXP / Vista: accept 'OPTIONS /' for a 'OPTIONS *'
44 # "win_accept_anonymous_options": False,
45 # "winxp_accept_root_share_login": False,
46 },
47 "property_manager": None, # True: use property_manager.PropertyManager
48 "mutable_live_props": [],
49 "lock_storage": True, # True: use LockManager(lock_storage.LockStorageDict)
50 "middleware_stack": [
51 # WsgiDavDebugFilter,
52 Cors,
53 ErrorPrinter,
54 HTTPAuthenticator,
55 WsgiDavDirBrowser, # configured under dir_browser option (see below)
56 RequestResolver, # this must be the last middleware item
57 ],
58 # HTTP Authentication Options
59 "http_authenticator": {
60 # None: dc.simple_dc.SimpleDomainController(user_mapping)
61 "domain_controller": None,
62 "accept_basic": True, # Allow basic authentication, True or False
63 "accept_digest": True, # Allow digest authentication, True or False
64 "default_to_digest": True, # True (default digest) or False (default basic)
65 # Name of a header field that will be accepted as authorized user
66 "trusted_auth_header": None,
67 },
68 #: Used by SimpleDomainController only
69 "simple_dc": {"user_mapping": {}}, # NO anonymous access by default
70 #: Verbose Output
71 #: 0 - no output
72 #: 1 - no output (excepting application exceptions)
73 #: 2 - show warnings
74 #: 3 - show single line request summaries (for HTTP logging)
75 #: 4 - show additional events
76 #: 5 - show full request/response header info (HTTP Logging)
77 #: request body and GET response bodies not shown
78 "verbose": DEFAULT_VERBOSE,
79 #: Log options
80 "logging": {
81 "logger_date_format": DEFAULT_LOGGER_DATE_FORMAT,
82 "logger_format": DEFAULT_LOGGER_FORMAT,
83 "enable_loggers": [],
84 "debug_methods": [],
85 },
86 #: Options for `WsgiDavDirBrowser`
87 "dir_browser": {
88 "enable": True, # Render HTML listing for GET requests on collections
89 # List of fnmatch patterns:
90 "ignore": [
91 ".DS_Store", # macOS folder meta data
92 "._*", # macOS hidden data files
93 "Thumbs.db", # Windows image previews
94 ],
95 "icon": True,
96 "response_trailer": True, # Raw HTML code, appended as footer (True: use a default)
97 "show_user": True, # Show authenticated user an realm
98 # Send <dm:mount> response if request URL contains '?davmount' (rfc4709)
99 "davmount": True,
100 # Add 'Mount' link at the top
101 "davmount_links": False,
102 "ms_sharepoint_support": True, # Invoke MS Office documents for editing using WebDAV
103 "libre_office_support": True, # Invoke Libre Office documents for editing using WebDAV
104 # The path to the directory that contains template.html and associated assets.
105 # The default is the htdocs directory within the dir_browser directory.
106 "htdocs_path": None,
107 },
108}
When a Python dict is passed to the WsgiDAVApp
constructor, its values will override the defaults from above:
root_path = gettempdir()
provider = FilesystemProvider(root_path)
config = {
"host": "0.0.0.0",
"port": 8080,
"provider_mapping": {"/": provider},
"verbose": 1,
}
app = WsgiDAVApp(config)
Use a Configuration File¶
When running from the CLI (command line interface), some settings may be passed as arguments, e.g.:
$ wsgidav --host=0.0.0.0 --port=8080 --root=/tmp --auth=anonymous
Serving on http://0.0.0.0:8080 ...
Much more options are available when a configuration file is used.
By default wsgidav.yaml
and wsgidav.json
are searched in the
local directory.
An alternative file name can be specified like so:
$ wsgidav --config=my_config.yaml
To prevent the use of a local default configuration file, use this option:
$ wsgidav --no-config
The options described below can be defined for the CLI either
Note
The two supported file formats are just different ways for the CLI to
generate a Python dict that is then passed to the
WsgiDAVApp
constructor.
The YAML format is recommended.
For a start, copy
YAML Sample Configuration
and edit it to your needs.
(Alternatively use
JSON Sample Configuration
.)
Verbosity Level¶
The verbosity level can have a value from 0 to 5 (default: 3):
Verbosity |
Option |
Log level |
Remarks |
---|---|---|---|
0 |
-qqq |
CRITICAL |
quiet |
1 |
ERROR |
no output (excepting application exceptions) |
|
2 |
-q |
WARN |
warnings and errors only |
3 |
INFO |
show single line request summaries (for HTTP logging) |
|
4 |
-v |
DEBUG |
show additional events |
5 |
-vv |
DEBUG |
show full request/response header info (HTTP Logging) request body and GET response bodies not shown |
Middleware Stack¶
WsgiDAV is built as WSGI application (WsgiDAVApp
)
that is extended by a list of middleware components which implement additional
functionality.
This stack is defined as a list of WSGI compliant application instances, e.g.:
from wsgidav.mw.debug_filter import WsgiDavDebugFilter
debug_filter = WsgiDavDebugFilter(wsgidav_app, next_app, config)
conf = {
...
"middleware_stack": [
debug_filter,
...
],
...
}
If the middleware class constructor has a common signature, it is sufficient to
pass the class instead of the instantiated object.
The built-in middleware derives from BaseMiddleware
,
so we can simplify as:
from wsgidav.dir_browser import WsgiDavDirBrowser
from wsgidav.mw.debug_filter import WsgiDavDebugFilter
from wsgidav.error_printer import ErrorPrinter
from wsgidav.http_authenticator import HTTPAuthenticator
from wsgidav.request_resolver import RequestResolver
conf = {
...
"middleware_stack": [
WsgiDavDebugFilter,
ErrorPrinter,
HTTPAuthenticator,
WsgiDavDirBrowser,
RequestResolver, # this must be the last middleware item
],
...
}
The middleware stack can be configured and extended. The following example removes the directory browser, and adds a third-party debugging tool:
import dozer
# from wsgidav.dir_browser import WsgiDavDirBrowser
from wsgidav.mw.debug_filter import WsgiDavDebugFilter
from wsgidav.error_printer import ErrorPrinter
from wsgidav.http_authenticator import HTTPAuthenticator
from wsgidav.request_resolver import RequestResolver
# Enable online profiling and GC inspection. See https://github.com/mgedmin/dozer
# (Requires `pip install Dozer`):
dozer_app = dozer.Dozer(wsgidav_app)
dozer_profiler = dozer.Profiler(dozer_app, None, "/tmp")
conf = {
...
"middleware_stack": [
dozer_app,
dozer_profiler,
WsgiDavDebugFilter,
ErrorPrinter,
HTTPAuthenticator,
# WsgiDavDirBrowser,
RequestResolver, # this must be the last middleware item
],
...
}
The stack can also be defined in text files, for example YAML. Again, we can pass an import path for a WSGI compliant class if the signature is known. For third-party middleware however, the constructor’s positional arguments should be explicitly listed:
...
middleware_stack:
- class: dozer.Dozer
args:
- "${application}"
- class: dozer.Profiler
args:
- "${application}"
- null # global_conf
- /tmp # profile_path
- wsgidav.mw.debug_filter.WsgiDavDebugFilter
- wsgidav.error_printer.ErrorPrinter
- wsgidav.http_authenticator.HTTPAuthenticator
- wsgidav.dir_browser.WsgiDavDirBrowser
- wsgidav.request_resolver.RequestResolver
It is also possible to pass options as named args (i.e. ‘kwargs’):
...
middleware_stack:
...
- class: dozer.Profiler
kwargs:
app: "${application}"
profile_path: /tmp
...
Note that the external middleware must be available, for example by calling
pip install Doze
, so this will not be possible if WsgiDAV is running from
the MSI installer.
DAVProvider¶
A DAVProvider handles read and write requests for all URLs that start with a given share path.
WsgiDAV comes bundled with FilesystemProvider
,
a DAVProvider that serves DAV requests by reading and writing to the server’s
file system.
However, custom DAVProviders may be implemented and used, that publish a
database backend, cloud drive, or any virtual data structure.
The provider_mapping
configuration routes share paths to specific
DAVProvider instances.
By default a writable FilesystemProvider
is
assumed, but can be forced to read-only.
Note that a DomainController may still restrict access completely or prevent
editing depending on authentication.
Three syntax variants are supported:
<mount_path>: <folder_path>
: useFilesystemProvider(folder_path)
<mount_path>: { "root": <folder_path>, "readonly": <bool> }
: useFilesystemProvider(folder_path, readonly)
<mount_path>: { "class": <class_path>, args: [arg, ...], kwargs: {"arg1": val1, "arg2": val2, ... }}
Instantiate a custom class (derrived fromDAVProvider
) using named kwargs.
For example:
provider_mapping:
"/": "/path/to/share1"
"/home": "~"
"/pub":
root: "/path/to/share2"
readonly: true
"/share3":
class: path.to.CustomDAVProviderClass
args:
- pos_arg1
- pos_arg2
kwargs:
path: '/path/to/share3'
another_arg: 42
Property Manager¶
The built-in PropertyManager`
.
Possible options are:
Disable locking, by passing
property_manager: null
.Enable default storage, which is implemented using a memory-based, not persistent storage, by passing
property_manager: true
. (This is an alias forproperty_manager: wsgidav.prop_man.property_manager.PropertyManager
)Enable an installed or custom storage
Example: Use a persistent shelve based property storage:
property_manager:
class: wsgidav.prop_man.property_manager.ShelvePropertyManager
storage_path: /path/to/wsgidav_locks.shelve
Lock Manager and Storage¶
The built-in LockManager
requires a
LockStorageDict
instance.
Possible options are:
Disable locking, by passing
lock_storage: null
.Enable default locking, which is implemented using a memory-based, not persistent storage, by passing
lock_storage: true
. (This is an alias forlock_storage: wsgidav.lock_man.lock_storage.LockStorageDict
)Enable an installed lock storage
A persistent, shelve based LockStorageShelve
is also available:
lock_storage:
class: wsgidav.lock_man.lock_storage.LockStorageShelve
kwargs:
storage_path: /path/to/wsgidav_locks.shelve
Domain Controller¶
The HTTP authentication middleware relies on a domain controller. Currently three variants are supported.
SimpleDomainController¶
The wsgidav.dc.simple_dc.SimpleDomainController
allows to authenticate
against a plain mapping of shares and user names.
The pseudo-share "*"
maps all URLs that are not explicitly listed.
A value of true
can be used to enable anonymous access.
Example YAML configuration:
http_authenticator:
domain_controller: null # Same as wsgidav.dc.simple_dc.SimpleDomainController
accept_basic: true # Pass false to prevent sending clear text passwords
accept_digest: true
default_to_digest: true
simple_dc:
user_mapping:
"*":
"user1":
password: "abc123"
"user2":
password: "qwerty"
"/pub": true
An optional roles list will be passed in environ[“wsgidav.auth.roles”] to downstream middleware. This is currently not used by the provided middleware, but may be handy for custom handlers:
simple_dc:
user_mapping:
"*":
"user1":
password: "abc123"
roles: ["editor", "admin"]
"user2":
password: "abc123"
roles: []
If no config file is used, anonymous authentication can be enabled on the command line like:
$ wsgidav ... --auth=anonymous
which simply defines this setting:
simple_dc:
user_mapping:
"*": true
NTDomainController¶
Allows users to authenticate against a Windows NT domain or a local computer.
The wsgidav.dc.nt_dc.NTDomainController
requires basic authentication
and therefore should use SSL.
Example YAML configuration:
ssl_certificate: wsgidav/server/sample_bogo_server.crt
ssl_private_key: wsgidav/server/sample_bogo_server.key
ssl_certificate_chain: None
http_authenticator:
domain_controller: wsgidav.dc.nt_dc.NTDomainController
accept_basic: true
accept_digest: false
default_to_digest: false
nt_dc:
preset_domain: null
preset_server: null
If no config file is used, NT authentication can be enabled on the command line like:
$ wsgidav ... --auth=nt
PAMDomainController¶
Allows users to authenticate against a PAM (Pluggable Authentication Modules), that are at the core of user authentication in any modern linux distribution and macOS.
The wsgidav.dc.pam_dc.PAMDomainController
requires basic
authentication and therefore should use SSL.
Example YAML configuration that authenticates users against the server’s known user accounts:
ssl_certificate: wsgidav/server/sample_bogo_server.crt
ssl_private_key: wsgidav/server/sample_bogo_server.key
ssl_certificate_chain: None
http_authenticator:
domain_controller: wsgidav.dc.pam_dc.PAMDomainController
accept_basic: true
accept_digest: false
default_to_digest: false
pam_dc:
service: "login"
If no config file is used, PAM authentication can be enabled on the command line like:
$ wsgidav ... --auth=pam-login
Custom Domain Controllers¶
A custom domain controller can be used like so:
http_authenticator:
domain_controller: path.to.CustomDomainController
The constructor must accept two arguments:
def __init__(self, wsgidav_app, config)
Note that this allows the custom controller to read the configuration dict and look for a custom section there.
Sample wsgidav.yaml
¶
The YAML syntax is the recommended format to define configuration:
Download Sample Configuration
.
1# WsgiDAV configuration file
2#
3# 1. Rename this file to `wsgidav.yaml`.
4# 2. Adjust settings as appropriate.
5# 3. Run `wsgidav` from the same directory or pass file path with `--config` option.
6#
7# See https://wsgidav.readthedocs.io/en/latest/user_guide_configure.html
8#
9# ============================================================================
10# SERVER OPTIONS
11
12#: Run WsgiDAV inside this WSGI server.
13#: Supported servers:
14#: cheroot, ext-wsgiutils, gevent, gunicorn, paste, uvicorn, wsgiref
15#: 'wsgiref' and 'ext_wsgiutils' are simple builtin servers that should *not* be
16#: used in production.
17#: All other servers must have been installed before, e.g. `pip install cheroot`.
18#: (The binary MSI distribution already includes 'cheroot'.)
19#: Default: 'cheroot', use the `--server` command line option to change this.
20
21server: cheroot
22
23#: Server specific arguments, passed to the server. For example cheroot:
24#: https://cheroot.cherrypy.dev/en/latest/pkg/cheroot.wsgi.html#cheroot.wsgi.Server
25# server_args:
26# max: -1
27# numthreads: 10
28# request_queue_size: 5
29# shutdown_timeout: 5
30# timeout: 10
31
32# Server hostname (default: localhost, use --host on command line)
33host: 0.0.0.0
34
35# Server port (default: 8080, use --port on command line)
36port: 8080
37
38# Transfer block size in bytes
39block_size: 8192
40
41#: Add the MS-Author-Via Response Header to OPTIONS command to allow editing
42#: with Microsoft Office (default: true)
43add_header_MS_Author_Via: true
44
45hotfixes:
46 #: Handle Microsoft's Win32LastModifiedTime property.
47 #: This is useful only in the case when you copy files from a Windows
48 #: client into a WebDAV share. Windows sends the "last modified" time of
49 #: the file in a Microsoft extended property called "Win32LastModifiedTime"
50 #: instead of the standard WebDAV property "getlastmodified". So without
51 #: this config option set to "True", the "last modified" time of the copied
52 #: file will be "now" instead of its original value.
53 #: The proper solution for dealing with the Windows WebDAV client is to use
54 #: a persistent property manager. This setting is merely a work-around.
55 #: NOTE: Works with Win10, can't work with Win7. Other versions untested.
56 emulate_win32_lastmod: false
57 #: Re-encode PATH_INFO using UTF-8 (falling back to ISO-8859-1).
58 #: This seems to be wrong, since per PEP 3333 PATH_INFO is always ISO-8859-1
59 #: encoded (see https://www.python.org/dev/peps/pep-3333/#unicode-issues).
60 #: However it also seems to resolve errors when accessing resources with
61 #: Chinese characters, for example (see issue #73).
62 re_encode_path_info: true
63 #: Force unquoting of PATH_INFO. This should already be done by the WSGI
64 #: Framework, so this setting should only be used to fix unexpected problems
65 #: there (false fixes issue #8, true fixes issue #228).
66 unquote_path_info: false
67 #: Hotfix for WinXP / Vista: accept 'OPTIONS /' for a 'OPTIONS *'
68 #: (default: false)
69 treat_root_options_as_asterisk: false
70
71
72# ----------------------------------------------------------------------------
73# SSL Support
74
75#: The certificate should match the servers hostname, so the bogus certs will
76#: not work in all scenarios.
77#: (Paths can be absolute or relative to this config file.)
78
79# ssl_certificate: 'wsgidav/server/sample_bogo_server.crt'
80# ssl_private_key: 'wsgidav/server/sample_bogo_server.key'
81# ssl_certificate_chain: null
82
83#: Cheroot server supports 'builtin' and 'pyopenssl' (default: 'builtin')
84# ssl_adapter: 'pyopenssl'
85
86# ----------------------------------------------------------------------------
87
88#: Modify to customize the WSGI application stack.
89#: See here for an example how to add custom middlewares:
90#: https://wsgidav.readthedocs.io/en/latest/user_guide_configure.html#middleware-stack
91middleware_stack:
92 - wsgidav.mw.cors.Cors
93 # - wsgidav.mw.debug_filter.WsgiDavDebugFilter
94 - wsgidav.error_printer.ErrorPrinter
95 - wsgidav.http_authenticator.HTTPAuthenticator
96 - wsgidav.dir_browser.WsgiDavDirBrowser
97 - wsgidav.request_resolver.RequestResolver # this must be the last middleware item
98
99# ==============================================================================
100# SHARES
101
102#: Application root, applied before provider mapping shares,
103#: e.g. <mount_path>/<share_name>/<res_path>
104mount_path: null
105
106#: Route share paths to DAVProvider instances
107#: By default a writable `FilesystemProvider` is assumed, but can be forced
108#: to read-only.
109#: Note that a DomainController may still restrict access completely or prevent
110#: editing depending on authentication.
111#:
112#: The following syntax variants are supported to use FilesystemProvider:
113#: <mount_path>: <folder_path>
114#: or
115#: <mount_path>: { 'root': <folder_path>, 'readonly': <bool> }
116#: or instantiate an arbitrary custom class:
117#: <mount_path>: { 'class': <class_path>, args: [<arg>, ...], kwargs: {<arg>: <val>, ...} }
118
119provider_mapping:
120 '/': '/path/to/share1'
121 '/pub':
122 root: '/path/to/share2'
123 readonly: true
124 '/share3':
125 class: path.to.CustomDAVProviderClass
126 kwargs:
127 path: '/path/to/share3'
128 another_arg: 42
129 # Example:
130 # make sure that a `/favicon.ico` URL is resolved, even if a `*.html`
131 # or `*.txt` resource file was opened using the DirBrowser
132 # '/':
133 # class: 'wsgidav.fs_dav_provider.FilesystemProvider'
134 # kwargs:
135 # root_folder: 'tests/fixtures/share'
136 # # readonly: true
137 # shadow:
138 # '/favicon.ico': 'file_path/to/favicon.ico'
139
140
141# ==============================================================================
142# AUTHENTICATION
143http_authenticator:
144 #: Allow basic authentication
145 accept_basic: true
146 #: Allow digest authentication
147 accept_digest: true
148 #: true (default digest) or false (default basic)
149 default_to_digest: true
150 #: Header field that will be accepted as authorized user.
151 #: Including quotes, for example: trusted_auth_header = 'REMOTE_USER'
152 trusted_auth_header: null
153 #: Domain controller that is used to resolve realms and authorization.
154 #: Default null: which uses SimpleDomainController and the
155 #: `simple_dc.user_mapping` option below.
156 #: (See http://wsgidav.readthedocs.io/en/latest/user_guide_configure.html
157 #: for details.)
158 domain_controller: null
159 # domain_controller: wsgidav.dc.simple_dc.SimpleDomainController
160 # domain_controller: wsgidav.dc.pam_dc.PAMDomainController
161 # domain_controller: wsgidav.dc.nt_dc.NTDomainController
162
163
164# Additional options for SimpleDomainController only:
165simple_dc:
166 # Access control per share.
167 # These routes must match the provider mapping.
168 # NOTE: Provider routes without a matching entry here, are inaccessible.
169 user_mapping:
170 '*': # default (used for all shares that are not explicitly listed)
171 'user1':
172 password: 'abc123'
173 # Optional: passed to downstream middleware as environ["wsgidav.auth.roles"]
174 roles: ['editor']
175 'user2':
176 password: 'def456'
177 password: 'qwerty'
178 '/pub': true # Pass true to allow anonymous access
179
180# Additional options for NTDomainController only:
181nt_dc:
182 preset_domain: null
183 preset_server: null
184
185# Additional options for PAMDomainController only:
186pam_dc:
187 service: 'login'
188 encoding: 'utf-8'
189 resetcreds: true
190
191
192# ----------------------------------------------------------------------------
193# CORS
194# (Requires `wsgidav.mw.cors.Cors`, which is enabled by default.)
195cors:
196 #: List of allowed Origins or '*'
197 #: Default: false, i.e. prevent CORS
198 allow_origin: null
199 # allow_origin: '*'
200 # allow_origin:
201 # - 'https://example.com'
202 # - 'https://localhost:8081'
203
204 #: List or comma-separated string of allowed methods (returned as
205 #: response to preflight request)
206 allow_methods:
207 # allow_methods: POST,HEAD
208 #: List or comma-separated string of allowed header names (returned as
209 #: response to preflight request)
210 allow_headers:
211 # - X-PINGOTHER
212 #: List or comma-separated string of allowed headers that JavaScript in
213 #: browsers is allowed to access.
214 expose_headers:
215 #: Set to true to allow responses on requests with credentials flag set
216 allow_credentials: false
217 #: Time in seconds for how long the response to the preflight request can
218 #: be cached (default: 5)
219 max_age: 600
220 #: Add custom response headers (dict of header-name -> header-value items)
221 #: (This is not related to CORS or required to implement CORS functionality)
222 add_always:
223 # 'X-Foo-Header: 'qux'
224
225# ----------------------------------------------------------------------------
226# Property Manager
227# null: (default) no support for dead properties
228# true: Use wsgidav.prop_man.property_manager.PropertyManager
229# which is an in-memory property manager (NOT persistent)
230#
231# Example: Use persistent shelve based property manager
232# property_manager:
233# class: wsgidav.prop_man.property_manager.ShelvePropertyManager
234# kwargs:
235# storage_path: 'wsgidav-props.shelve'
236
237property_manager: null
238
239#: Optional additional live property modification
240#: Note: by default live properties like file size and last-modified time are
241#: read-only, but that can be overriden here if the underlying DAV provider
242#: supports it. For now only the FileSystemProvider supports it and only namely
243#: changes to the last-modified timestamp. Enable it with the mutable_live_props
244#: list as below to allow clients to use the utime system call or e.g. the
245#: touch or cp / rsync commands with the preserve-timestamp flags on a mounted
246#: DAV share.
247#: Please note that the timestamp is set on the actual file or directory, so it
248#: is persistent even for in-memory property managers. It should also be noted
249#: that mutable last-modified may not be compliant with the RFC 4918.
250mutable_live_props:
251 # Enable to allow clients to use e.g. the touch or cp / rsync commands with the
252 # preserve-timestamp flags in a mounted DAV share (may be RFC4918 incompliant)
253 - '{DAV:}getlastmodified'
254
255
256# ----------------------------------------------------------------------------
257# Lock Manager Storage
258#
259# null: No lock support
260# true: (default) shortcut for
261# lock_storage: wsgidav.lock_man.lock_storage.LockStorageDict
262#
263# Note that the default LockStorageDict works in-memory, so it is
264# NOT persistent.
265#
266# Example: Use persistent shelve based lock storage:
267# lock_storage:
268# class: wsgidav.lock_man.lock_storage.LockStorageShelve
269# kwargs:
270# storage_path: /path/to/wsgidav_locks.shelve
271#
272# Check the documentation on how to develop custom lock storage.
273
274lock_storage: true
275
276
277# ==============================================================================
278# DEBUGGING
279
280#: Set verbosity level (can be overridden by -v or -q arguments)
281verbose: 3
282
283logging:
284 #: Set logging output format
285 #: (see https://docs.python.org/3/library/logging.html#logging.Formatter)
286 logger_date_format: '%H:%M:%S'
287 logger_format: '%(asctime)s.%(msecs)03d - %(levelname)-8s: %(message)s'
288 # Example: Add date,thread id, and logger name:
289 # logger_date_format: '%Y-%m-%d %H:%M:%S'
290 # logger_format: '%(asctime)s.%(msecs)03d - <%(thread)05d> %(name)-27s %(levelname)-8s: %(message)s'
291
292 #: Enable specific module loggers
293 #: E.g. ['lock_manager', 'property_manager', 'http_authenticator', ...]
294 # enable_loggers: ['http_authenticator', ]
295
296 # Enable max. logging for certain http methods
297 # E.g. ['COPY', 'DELETE', 'GET', 'HEAD', 'LOCK', 'MOVE', 'OPTIONS', 'PROPFIND', 'PROPPATCH', 'PUT', 'UNLOCK']
298 debug_methods: []
299
300 # Enable max. logging during litmus suite tests that contain certain strings
301 # E.g. ['lock_excl', 'notowner_modify', 'fail_cond_put_unlocked', ...]
302 debug_litmus: []
303
304
305# ----------------------------------------------------------------------------
306# WsgiDavDirBrowser
307
308dir_browser:
309 enable: true
310 #: List of fnmatch patterns that will be hidden in the directory listing
311 ignore:
312 - '.DS_Store' # macOS folder meta data
313 - 'Thumbs.db' # Windows image previews
314 - '._*' # macOS hidden data files
315 #: Display WsgiDAV icon in header
316 icon: true
317 #: Raw HTML code, appended as footer (true: use a default trailer)
318 response_trailer: true
319 #: Display the name and realm of the authenticated user (or 'anomymous')
320 show_user: true
321 show_logout: true
322 #: Send <dm:mount> response if request URL contains '?davmount'
323 #: (See https://tools.ietf.org/html/rfc4709)
324 davmount: true
325 #: Add a 'Mount' link at the top of the listing
326 davmount_links: false
327 #: Invoke MS Office documents for editing using WebDAV by adding a JavaScript
328 #: click handler.
329 #: - For IE 11 and below invokes the SharePoint ActiveXObject("SharePoint.OpenDocuments")
330 #: - If the custom legacy Firefox plugin is available, it will be used
331 #: https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ff407576(v%3Doffice.14)
332 #: - Otherwise the Office URL prefix is used (e.g. 'ms-word:ofe|u|http://server/path/file.docx')
333 ms_sharepoint_support: true
334 #: Invoke Libre Office documents for editing using WebDAV
335 libre_office_support: true
336 #: The path to the directory that contains template.html and associated
337 #: assets.
338 #: The default is the htdocs directory within the dir_browser directory.
339 htdocs_path: null
Sample wsgidav.json
¶
We can also use a JSON file for configuration. The structure is identical to the YAML format.
See the ./sample_wsgidav.json example. (Note that the parser allows JavaScript-style comments)