}
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)