mirror of
https://github.com/hacdias/webdav.git
synced 2026-09-22 03:20:41 +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 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY --from=build /webdav/main /bin/webdav
|
COPY --from=build /webdav/main /bin/webdav
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 6065
|
||||||
|
|
||||||
ENTRYPOINT [ "webdav" ]
|
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
|
```yaml
|
||||||
address: 0.0.0.0
|
address: 0.0.0.0
|
||||||
port: 0
|
port: 6065
|
||||||
|
|
||||||
# TLS-related settings if you want to enable TLS directly.
|
# TLS-related settings if you want to enable TLS directly.
|
||||||
tls: false
|
tls: false
|
||||||
@@ -76,8 +76,8 @@ auth: true
|
|||||||
|
|
||||||
# The directory that will be able to be accessed by the users when connecting.
|
# 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.
|
# This directory will be used by users unless they have their own 'scope' defined.
|
||||||
# Default is "/".
|
# Default is "." (current directory).
|
||||||
scope: /
|
scope: .
|
||||||
|
|
||||||
# Whether the users can, by default, modify the contents. Default is false.
|
# Whether the users can, by default, modify the contents. Default is false.
|
||||||
modify: true
|
modify: true
|
||||||
|
|||||||
+2
-2
@@ -12,7 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DefaultScope = "/"
|
DefaultScope = "."
|
||||||
DefaultModify = false
|
DefaultModify = false
|
||||||
DefaultDebug = false
|
DefaultDebug = false
|
||||||
DefaultNoSniff = false
|
DefaultNoSniff = false
|
||||||
@@ -21,7 +21,7 @@ const (
|
|||||||
DefaultCert = "cert.pem"
|
DefaultCert = "cert.pem"
|
||||||
DefaultKey = "key.pem"
|
DefaultKey = "key.pem"
|
||||||
DefaultAddress = "0.0.0.0"
|
DefaultAddress = "0.0.0.0"
|
||||||
DefaultPort = 0
|
DefaultPort = 6065
|
||||||
DefaultPrefix = "/"
|
DefaultPrefix = "/"
|
||||||
DefaultLogFormat = "console"
|
DefaultLogFormat = "console"
|
||||||
)
|
)
|
||||||
|
|||||||
+4
-1
@@ -34,7 +34,10 @@ func TestConfigDefaults(t *testing.T) {
|
|||||||
require.EqualValues(t, DefaultPort, cfg.Port)
|
require.EqualValues(t, DefaultPort, cfg.Port)
|
||||||
require.EqualValues(t, DefaultPrefix, cfg.Prefix)
|
require.EqualValues(t, DefaultPrefix, cfg.Prefix)
|
||||||
require.EqualValues(t, DefaultLogFormat, cfg.LogFormat)
|
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.AllowedHeaders)
|
||||||
require.EqualValues(t, []string{"*"}, cfg.CORS.AllowedHosts)
|
require.EqualValues(t, []string{"*"}, cfg.CORS.AllowedHosts)
|
||||||
|
|||||||
Reference in New Issue
Block a user