Skip to content

Commit

Permalink
Fixed small bug in game colors
Browse files Browse the repository at this point in the history
  • Loading branch information
jensborch committed Nov 29, 2022
1 parent 037d7d0 commit 86266e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Games.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const WinnerButton = ({
);

const findColor = (color: string): string => {
switch (color) {
switch (color.toLowerCase()) {
case "red":
return red[400];
case "pink":
Expand Down
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"embed"
"flag"
"io/fs"
"log"
"net/http"
"os"
"strconv"
Expand Down Expand Up @@ -46,7 +47,7 @@ func main() {
flag.StringVar(&dbfile, "db", "foosball.db", "the database file")
flag.BoolVar(&debug, "debug", false, "enable debug")
flag.Parse()

log.Printf("Starting go-foosball on port %d using database %s", port, dbfile)
engine, _ := setupServer(dbfile, debug)
engine.Run(":" + strconv.FormatUint(uint64(port), 10))
}
Expand All @@ -58,12 +59,12 @@ func corsHandler() gin.HandlerFunc {
}

func setupServer(dbfile string, debug bool) (*gin.Engine, *gorm.DB) {
var log logger.Interface
var gormlog logger.Interface
if !debug {
gin.SetMode(gin.ReleaseMode)
log = logger.Default.LogMode(logger.Warn)
gormlog = logger.Default.LogMode(logger.Warn)
} else {
log = logger.Default.LogMode(logger.Info)
gormlog = logger.Default.LogMode(logger.Info)
}

router := gin.Default()
Expand All @@ -76,7 +77,7 @@ func setupServer(dbfile string, debug bool) (*gin.Engine, *gorm.DB) {
}

db, err := gorm.Open(sqlite.Open(dbfile), &gorm.Config{
Logger: log,
Logger: gormlog,
})
if err != nil {
panic("failed to connect database")
Expand Down

0 comments on commit 86266e3

Please sign in to comment.