diff options
author | Andinus <andinus@nand.sh> | 2020-03-29 16:10:59 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2020-03-29 16:10:59 +0530 |
commit | a6826055bf4e6a23f80da047ccfe4509a209f3a6 (patch) | |
tree | f2bb2bec35ee5e61cb42f4edffb04368a0f8ba60 /cmd | |
parent | 7b95d6b80dd2d1efb26f7c515383abd4f0dc9d42 (diff) | |
download | perseus-a6826055bf4e6a23f80da047ccfe4509a209f3a6.tar.gz |
Initial perseus rewrite
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/perseus/main.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/cmd/perseus/main.go b/cmd/perseus/main.go index 6abd3a4..ca1a50d 100644 --- a/cmd/perseus/main.go +++ b/cmd/perseus/main.go @@ -15,25 +15,24 @@ func main() { db := storage.Init() defer db.Conn.Close() - envPort, exists := os.LookupEnv("PERSEUS_PORT") - if !exists { + envPort := os.Getenv("PERSEUS_PORT") + if envPort == "" { envPort = "8080" } - addr := fmt.Sprintf("127.0.0.1:%s", envPort) srv := &http.Server{ - Addr: addr, + Addr: fmt.Sprintf("127.0.0.1:%s", envPort), WriteTimeout: 8 * time.Second, ReadTimeout: 8 * time.Second, } http.HandleFunc("/register", func(w http.ResponseWriter, r *http.Request) { - web.HandleRegister(w, r, db) + web.RegisterHandler(w, r, db) }) http.HandleFunc("/login", func(w http.ResponseWriter, r *http.Request) { - web.HandleLogin(w, r, db) + web.LoginHandler(w, r, db) }) - log.Printf("main/main.go: listening on port %s...", envPort) + log.Printf("perseus: listening on port %s...", envPort) log.Fatal(srv.ListenAndServe()) } |