diff options
Diffstat (limited to 'src/main.go')
-rw-r--r-- | src/main.go | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/src/main.go b/src/main.go index 2c99242..38f254c 100644 --- a/src/main.go +++ b/src/main.go @@ -1,7 +1,6 @@ package main import ( - "database/sql" "flag" "fmt" "log" @@ -22,31 +21,16 @@ func main() { log.Printf("Running HTTP server on port %d", *port) httpServer := setupHTTPServer() + // Set up the DB connection + db := setupDatabase() + name := getName(db) + fmt.Println(name) + // React to system signals signalChannel := make(chan os.Signal, 1) signal.Notify(signalChannel) go cleanup(signalChannel, httpServer) - //////////////////////////////////////////////////////////////////////////////// - - connStr := "user=postgres dbname=postgres sslmode=disable" - db, err := sql.Open("postgres", connStr) - if err != nil { - log.Fatal(err) - } - - // get the current name of the challenges - query := fmt.Sprintf("SELECT name FROM challenges") - var name string - err = db.QueryRow(query).Scan(&name) - if err != nil { - log.Fatalf("[ E ] :", err) - } - - fmt.Println(name) - - //////////////////////////////////////////////////////////////////////////////// - // Start our HTTP server log.Fatalln(httpServer.ListenAndServe()) } |