From ed23ca1820eeeb030ef2f14fe16adb3466e273e6 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Tue, 23 Jul 2024 08:00:01 +0200 Subject: [PATCH] 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. --- Dockerfile | 3 +-- README.md | 6 +++--- lib/config.go | 4 ++-- lib/config_test.go | 5 ++++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9ff8719..702f118 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" ] diff --git a/README.md b/README.md index c451fb0..0c87983 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lib/config.go b/lib/config.go index 93e7c3e..7cea95d 100644 --- a/lib/config.go +++ b/lib/config.go @@ -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" ) diff --git a/lib/config_test.go b/lib/config_test.go index 21291fc..87378e6 100644 --- a/lib/config_test.go +++ b/lib/config_test.go @@ -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)