-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor user file structure, add mocks and tests #22
Conversation
marrriamme
commented
Mar 6, 2025
- Поменяла разположение файлов
- Добавила моки
- Добавила тесты
internal/transport/jwt/jwt.go
Outdated
if err != nil { | ||
log.Fatal("Error loading .env file") | ||
} | ||
secretKey := os.Getenv("TOKEN_SECRET") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Переименуй в JWT_SIGNATURE
internal/transport/jwt/jwt.go
Outdated
func (t *Tokenator) ParseJWT(tokenString string) (*JWTClaims, error) { | ||
err := godotenv.Load() | ||
if err != nil { | ||
log.Fatal("Error loading .env file") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fatal насколько я помню делает под капотом os.Exit(1), тут лучше просто залогировать и вернуть ошибку. Если ещё где-то есть log.Fatal(), кроме main.go, то тоже поправь(к тестам не относится)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Всё круто, пару комментов оставил, как поправишь - можешь вливать. Также перед тем как вливать сделай rebase на develop и go mod tidy, чтобы конфликтов не было. И кинь пж в чатик в тг файл .env, чтобы все его могли юзать