diff --git a/Dockerfile b/Dockerfile index b4bf097..863d3fa 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 f24d810..ac7c0a5 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,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 @@ -74,8 +74,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..c8d1c4c 100644 --- a/lib/config.go +++ b/lib/config.go @@ -21,7 +21,7 @@ const ( DefaultCert = "cert.pem" DefaultKey = "key.pem" DefaultAddress = "0.0.0.0" - DefaultPort = 0 + DefaultPort = 6065 DefaultPrefix = "/" DefaultLogFormat = "console" ) @@ -89,6 +89,7 @@ func ParseConfig(filename string, flags *pflag.FlagSet) (*Config, error) { v.SetDefault("Log_Format", DefaultLogFormat) // Other defaults + v.SetDefault("Scope", ".") v.SetDefault("CORS.Allowed_Headers", []string{"*"}) v.SetDefault("CORS.Allowed_Hosts", []string{"*"}) v.SetDefault("CORS.Allowed_Methods", []string{"*"}) 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)