mirror of
https://github.com/hacdias/webdav.git
synced 2026-09-21 19:10:42 +08:00
feat!: change default port and scope
BREAKING CHANGE: the default port is no longer random, but 6065. The default scope is now the current directory instead of the root directory.
This commit is contained in:
+1
-2
@@ -18,7 +18,6 @@ FROM scratch
|
||||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
COPY --from=build /webdav/main /bin/webdav
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 6065
|
||||
|
||||
ENTRYPOINT [ "webdav" ]
|
||||
CMD [ "-p", "80" ]
|
||||
|
||||
@@ -57,7 +57,7 @@ The configuration can be provided as a YAML, JSON or TOML file. Below is an exam
|
||||
|
||||
```yaml
|
||||
address: 0.0.0.0
|
||||
port: 0
|
||||
port: 6065
|
||||
|
||||
# TLS-related settings if you want to enable TLS directly.
|
||||
tls: false
|
||||
@@ -76,8 +76,8 @@ auth: true
|
||||
|
||||
# The directory that will be able to be accessed by the users when connecting.
|
||||
# This directory will be used by users unless they have their own 'scope' defined.
|
||||
# Default is "/".
|
||||
scope: /
|
||||
# Default is "." (current directory).
|
||||
scope: .
|
||||
|
||||
# Whether the users can, by default, modify the contents. Default is false.
|
||||
modify: true
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultScope = "/"
|
||||
DefaultScope = "."
|
||||
DefaultModify = false
|
||||
DefaultDebug = false
|
||||
DefaultNoSniff = false
|
||||
@@ -21,7 +21,7 @@ const (
|
||||
DefaultCert = "cert.pem"
|
||||
DefaultKey = "key.pem"
|
||||
DefaultAddress = "0.0.0.0"
|
||||
DefaultPort = 0
|
||||
DefaultPort = 6065
|
||||
DefaultPrefix = "/"
|
||||
DefaultLogFormat = "console"
|
||||
)
|
||||
|
||||
+4
-1
@@ -34,7 +34,10 @@ func TestConfigDefaults(t *testing.T) {
|
||||
require.EqualValues(t, DefaultPort, cfg.Port)
|
||||
require.EqualValues(t, DefaultPrefix, cfg.Prefix)
|
||||
require.EqualValues(t, DefaultLogFormat, cfg.LogFormat)
|
||||
require.NotEmpty(t, cfg.Scope)
|
||||
|
||||
dir, err := os.Getwd()
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, dir, cfg.Scope)
|
||||
|
||||
require.EqualValues(t, []string{"*"}, cfg.CORS.AllowedHeaders)
|
||||
require.EqualValues(t, []string{"*"}, cfg.CORS.AllowedHosts)
|
||||
|
||||
Reference in New Issue
Block a user