1
0
Fork 0
mirror of https://github.com/Luzifer/password.git synced 2024-12-19 20:31:18 +00:00

Fix: Log error when listen is not possible

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-06-27 19:57:07 +02:00
parent af53a31d2c
commit 9a24ca807b
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -37,7 +37,9 @@ func actionCmdServe(cmd *cobra.Command, args []string) {
r.HandleFunc("/v1/getPassword", handleAPIGetPasswordv1).Methods("GET")
http.Handle("/", r)
http.ListenAndServe(fmt.Sprintf(":%d", flags.Server.Port), nil)
if err := http.ListenAndServe(fmt.Sprintf(":%d", flags.Server.Port), nil); err != nil {
log.Fatalf("listening on port :%d: %s", flags.Server.Port, err)
}
}
func handleAPIGetPasswordv1(res http.ResponseWriter, r *http.Request) {