Skip to content

Commit

Permalink
Switched to release mode + small json speedup
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLovesDoggo committed May 31, 2024
1 parent 1c8ba2a commit d920537
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM golang:1.22@sha256:0b55ab82ac2a54a6f8f85ec8b943b9e470c39e32c109b766bbc1b801
WORKDIR /src
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -o ./abacus
RUN CGO_ENABLED=0 GOOS=linux go build -o ./abacus -tags=jsoniter

# Run stage
FROM alpine:latest
Expand Down
11 changes: 10 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package main

import (
"fmt"
"github.com/redis/go-redis/v9"
"net/http"
"os"
"strconv"
"strings"
"time"

"github.com/redis/go-redis/v9"

"github.com/jasonlovesdoggo/abacus/middleware"

"github.com/gin-contrib/cors"
Expand All @@ -33,6 +35,13 @@ var (
func init() {
// Connect to Redis
utils.LoadEnv()

if strings.ToLower(os.Getenv("DEBUG")) == "true" {
gin.SetMode(gin.DebugMode)
} else {
gin.SetMode(gin.ReleaseMode)
}

ADDR := os.Getenv("REDIS_HOST") + ":" + os.Getenv("REDIS_PORT")
fmt.Println("Listening to redis on: " + ADDR)
DbNum, _ := strconv.Atoi(os.Getenv("REDIS_DB"))
Expand Down

0 comments on commit d920537

Please sign in to comment.