Compare commits

...
2 Commits
Author SHA1 Message Date
Henrique Dias 764a69cd33 fix: numeric passwords (#24)
License: MIT
Signed-off-by: Henrique Dias <[email protected]>
2019-06-09 13:51:53 +01:00
Henrique Dias d266f1150e fix: auth enabled by default
License: MIT
Signed-off-by: Henrique Dias <[email protected]>
2019-06-09 13:47:28 +01:00
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -5,6 +5,7 @@ import (
"log" "log"
"os" "os"
"regexp" "regexp"
"strconv"
"strings" "strings"
"github.com/hacdias/webdav/webdav" "github.com/hacdias/webdav/webdav"
@@ -81,6 +82,10 @@ func parseUsers(raw []interface{}, c *webdav.Config) {
password, ok := u["password"].(string) password, ok := u["password"].(string)
if !ok { if !ok {
password = "" password = ""
if numPwd, ok := u["password"].(int); ok {
password = strconv.Itoa(numPwd)
}
} }
if strings.HasPrefix(password, "{env}") { if strings.HasPrefix(password, "{env}") {
+1
View File
@@ -21,6 +21,7 @@ func init() {
flags := rootCmd.Flags() flags := rootCmd.Flags()
flags.StringVarP(&cfgFile, "config", "c", "", "config file path") flags.StringVarP(&cfgFile, "config", "c", "", "config file path")
flags.BoolP("tls", "t", false, "enable tls") flags.BoolP("tls", "t", false, "enable tls")
flags.Bool("auth", true, "enable auth")
flags.String("cert", "cert.pem", "TLS certificate") flags.String("cert", "cert.pem", "TLS certificate")
flags.String("key", "key.pem", "TLS key") flags.String("key", "key.pem", "TLS key")
flags.StringP("address", "a", "0.0.0.0", "address to listen to") flags.StringP("address", "a", "0.0.0.0", "address to listen to")