11# Config File
22
3- ## ` webdav.json ` file
3+ ## ` webdav.toml ` file
4+
5+ ### Convert ` .json ` to ` .toml `
6+
7+ please search ` convert json toml ` in your browser.
48
59### When the file does not exist
610
7- When the file ` /data/webdav.json ` does not exist, ` http://127.0.0.1/ ` will map to the ` /data ` directory.
11+ When the file ` /data/webdav.toml(. json) ` does not exist, ` http://127.0.0.1/ ` will map to the ` /data ` directory.
812
913#### logging output
1014
@@ -21,62 +25,54 @@ INFO: [uvicorn] Uvicorn running on http://0.0.0.0:80 (Press CTRL+C to quit)
2125
2226When the file exists, the mapping relationship is defined by the file content.
2327
24- #### Sample
25-
26- ``` json
27- {
28- "account_mapping" : [
29- {
30- "username" : " username" ,
31- "password" : " password" ,
32- "permissions" : [" +" ]
33- },
34- {
35- "username" : " litmus" ,
36- "password" : " password" ,
37- "permissions" : [" +^/$" , " +^/litmus" , " -^/litmus/other" ]
38- },
39- {
40- "username" : " guest" ,
41- "password" : " password" ,
42- "permissions" : []
43- }
44- ],
45- "anonymous" : { "enable" : true },
46- "http_basic_auth" : {
47- "cache_type" : " expiring" ,
48- "cache_timeout" : 3600
49- },
50- "provider_mapping" : [
51- {
52- "prefix" : " /" ,
53- "uri" : " file:///data/root" ,
54- "read_only" : true
55- },
56- {
57- "prefix" : " /provider" ,
58- "uri" : " memory:///" ,
59- "read_only" : true
60- },
61- {
62- "prefix" : " /provider/fs" ,
63- "uri" : " file:///data/litmus"
64- },
65- {
66- "prefix" : " /provider/memory" ,
67- "uri" : " memory:///" ,
68- "ignore_property_extra" : false
69- },
70- {
71- "prefix" : " /~" ,
72- "uri" : " file:///data/home" ,
73- "home_dir" : true
74- }
75- ],
76- "logging_level" : " INFO"
77- }
28+ #### Example
29+
30+ ``` toml
31+ [[account_mapping ]]
32+ username = " username"
33+ password = " password"
34+ permissions = [ " +" ]
35+
36+ [[account_mapping ]]
37+ username = " litmus"
38+ password = " password"
39+ permissions = [ " +^/$" , " +^/litmus" , " -^/litmus/other" ]
40+
41+ [[account_mapping ]]
42+ username = " guest"
43+ password = " password"
44+ permissions = [ ]
45+
46+ [anonymous ]
47+ enable = true
48+
49+ [[provider_mapping ]]
50+ prefix = " /"
51+ uri = " file:///data/root"
52+ read_only = true
53+
54+ [[provider_mapping ]]
55+ prefix = " /provider"
56+ uri = " memory:///"
57+ read_only = true
58+
59+ [[provider_mapping ]]
60+ prefix = " /provider/fs"
61+ uri = " file:///data/litmus"
62+
63+ [[provider_mapping ]]
64+ prefix = " /provider/memory"
65+ uri = " memory:///"
66+ ignore_property_extra = false
67+
68+ [[provider_mapping ]]
69+ prefix = " /~"
70+ uri = " file:///data/home"
71+ home_dir = true
7872```
7973
74+ More example please check ` examples/config/*.toml ` in codebase.
75+
8076#### logging output
8177
8278``` text
@@ -112,24 +108,9 @@ root object
112108| text_file_charset_detect | rules | ` TextFileCharsetDetect ` | ` TextFileCharsetDetect() ` |
113109| compression | response | ` Compression ` | ` Compression() ` |
114110| cors | response | ` CORS ` | ` CORS() ` |
115- | logging_level | other | ` str ` | ` "INFO" ` |
116-
117- Example
118-
119- ``` text
120- {
121- "account_mapping": [...],
122- "anonymous": {...},
123- "http_digest_auth": {...},
124- "provider_mapping": [...],
125- "hide_file_in_dir": {...},
126- "guess_type_extension": {...},
127- "text_file_charset_detect": {...},
128- "compression": {...},
129- "cors": {...},
130- "logging_level": "INFO"
131- }
132- ```
111+ | enable_dir_browser | response | ` bool ` | ` true ` |
112+ | logging | other | ` Logging ` | ` "Logging()" ` |
113+ | sentry_dsn | other | ` str ` | ` None ` |
133114
134115## for Authentication
135116
@@ -330,3 +311,15 @@ More detail, please see howto.
330311| allow_credentials | bool | ` false ` | - |
331312| expose_headers | list[ str] | ` [] ` | - |
332313| preflight_max_age | int | ` 600 ` | - |
314+
315+ ### ` logging ` Object
316+
317+ - Introduced in 1.4
318+ - Last updated in 1.4
319+
320+ | Key | Value Type | Default Value |
321+ | ---------------- | ---------- | ------------- |
322+ | enable | bool | ` true ` |
323+ | level | str | ` "INFO" ` |
324+ | display_datetime | bool | ` true ` |
325+ | use_colors | bool | ` true ` |
0 commit comments