Browse Source

Only call AuthLoadFile() once at startup

Jonathon Reinhart 4 years ago
parent
commit
70dfe6b128
1 changed files with 7 additions and 5 deletions
  1. 7 5
      main.go

+ 7 - 5
main.go

@@ -257,6 +257,13 @@ func main() {
 		log.SetOutput(io.MultiWriter(os.Stdout, f))
 	}
 
+	// Load allowed users file
+	if *allowedUsers != "" {
+		err := AuthLoadFile(*allowedUsers)
+		if err != nil {
+			log.Fatalf("Authentication file: %s\n", err)
+		}
+	}
 
 	// Create a server for each desired listen address
 	for _, listenAddr := range strings.Split(*listen, " ") {
@@ -270,11 +277,6 @@ func main() {
 		}
 
 		if *allowedUsers != "" {
-			err := AuthLoadFile(*allowedUsers)
-			if err != nil {
-				log.Fatalf("Authentication file: %s\n", err)
-			}
-
 			server.Authenticator = authChecker
 		}