From 5ba0b02bd5bf9d6a6e70775b99de5156cb6a889a Mon Sep 17 00:00:00 2001 From: Perlover Date: Tue, 1 Aug 2023 20:16:22 +0200 Subject: [PATCH] If ALLOW_API is false then server is not run I think it will be fix Issue: https://github.com/believethehype/nostdress/issues/25 --- main.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/main.go b/main.go index 85d3aba..e026b8d 100644 --- a/main.go +++ b/main.go @@ -279,18 +279,17 @@ func main() { api.HandleFunc("/users/{name}@{domain}", GetUser).Methods("GET") api.HandleFunc("/users/{name}@{domain}", UpdateUser).Methods("PUT") api.HandleFunc("/users/{name}@{domain}", DeleteUser).Methods("DELETE") - - srv := &http.Server{ - Handler: cors.Default().Handler(router), - Addr: s.Host + ":" + s.Port, - WriteTimeout: 15 * time.Second, - ReadTimeout: 15 * time.Second, - } - log.Debug().Str("addr", srv.Addr).Msg("listening") - - srv.ListenAndServe() - } + + srv := &http.Server{ + Handler: cors.Default().Handler(router), + Addr: s.Host + ":" + s.Port, + WriteTimeout: 15 * time.Second, + ReadTimeout: 15 * time.Second, + } + log.Debug().Str("addr", srv.Addr).Msg("listening") + + srv.ListenAndServe() } func getDomains(s string) []string {