]> Cypherpunks.ru repositories - gocheese.git/blobdiff - gocheese.go
Descriptive passwords parsing
[gocheese.git] / gocheese.go
index fa2fb59040de0021f714ccc28b2468f4ffb57c7b..1d8d0b5425b6541b2f9906ef822e7a856c9288fb 100644 (file)
@@ -455,22 +455,7 @@ func main() {
                }
                return
        }
-       passwd, err := ioutil.ReadFile(*passwdPath)
-       if err != nil {
-               log.Fatal(err)
-       }
-       for _, credentials := range strings.Split(strings.TrimRight(string(passwd), "\n"), "\n") {
-               splitted := strings.Split(credentials, ":")
-               if len(splitted) != 2 {
-                       log.Fatal("Wrong login:password format")
-               }
-               _, auther, err := strToAuther(splitted[1])
-               if err != nil {
-                       log.Fatal(err)
-               }
-               passwords[splitted[0]] = auther
-               log.Println("Added password for " + splitted[0])
-       }
+       refreshPasswd()
        log.Println("root:", *root, "bind:", *bind)
        http.HandleFunc(*norefreshURLPath, handler)
        http.HandleFunc(*refreshURLPath, handler)