Compare commits

..

1 Commits

Author SHA1 Message Date
46e93aeefd log-inside-post
All checks were successful
deploy / deploy (push) Successful in 1m31s
2024-06-06 14:50:29 +03:00
4 changed files with 16 additions and 13 deletions

View File

@ -33,4 +33,3 @@ jobs:
branch: "main" branch: "main"
git_remote_url: "ssh://dokku@v2.discours.io:22/authorizer" git_remote_url: "ssh://dokku@v2.discours.io:22/authorizer"
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
git_push_flags: '--force'

View File

@ -1,4 +1,4 @@
FROM golang:1.21.3-alpine3.18 AS go-builder FROM golang:1.21.3-alpine3.18 as go-builder
WORKDIR /authorizer WORKDIR /authorizer
COPY server server COPY server server
COPY Makefile . COPY Makefile .
@ -11,7 +11,7 @@ RUN apk add build-base &&\
make clean && make && \ make clean && make && \
chmod 777 build/server chmod 777 build/server
FROM node:20-alpine3.18 AS node-builder FROM node:20-alpine3.18 as node-builder
WORKDIR /authorizer WORKDIR /authorizer
COPY app app COPY app app
COPY dashboard dashboard COPY dashboard dashboard

View File

@ -34,12 +34,16 @@ func (u LogTextFormatter) Format(e *logrus.Entry) ([]byte, error) {
color = "\033[0m" // reset color = "\033[0m" // reset
} }
if e.Caller != nil { var fields string
fmt.Sprintf("%r", e) for key, value := range e.Data {
file := filepath.Base(e.Caller.File) fields += fmt.Sprintf("%s=%v ", key, value)
line := e.Caller.Line
return []byte(fmt.Sprintf("%s[%s] %s:%d %s%s\033[0m\n", color, level, file, line, message, color)), nil
} }
return []byte(fmt.Sprintf("%s[%s] %s%s\033[0m\n", color, level, message, color)), nil if e.Caller != nil {
file := filepath.Base(e.Caller.File)
line := e.Caller.Line
return []byte(fmt.Sprintf("%s[%s] %s:%d %s %s%s\033[0m\n", color, level, file, line, message, fields, color)), nil
}
return []byte(fmt.Sprintf("%s[%s] %s %s%s\033[0m\n", color, level, message, fields, color)), nil
} }

View File

@ -234,10 +234,10 @@ func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
rkey := fmt.Sprintf("author:user:%s", userId) rkey := fmt.Sprintf("author:user:%s", userId)
fmt.Println("get redis cached by key:", rkey) fmt.Println("get redis cached by key:", rkey)
authorIdString, err := c.store.Get(c.ctx, rkey).Result() authorIdString, err := c.store.Get(c.ctx, rkey).Result()
fmt.Println("redis found string value:", authorIdString)
if err != nil { if err != nil {
return "", err return "", err
} }
fmt.Println("redis found string value:", authorIdString)
// Преобразуем ID автора из строки в int // Преобразуем ID автора из строки в int
var authorIdFloat float64 var authorIdFloat float64