feat: 인프라 개선 — 헬스체크, 로깅, 보안, CI 검증
- /health + /ready 엔드포인트 추가 (DB/Redis 상태 확인) - RequestID 미들웨어 + 구조화 JSON 로깅 - 체인 트랜잭션 per-user rate limit (20 req/min) - DB 커넥션 풀 설정 (MaxOpen 25, MaxIdle 10, MaxLifetime 5m) - Graceful Shutdown 시 Redis/MySQL 연결 정리 - Dockerfile HEALTHCHECK 추가 - CI에 go vet + 빌드 검증 단계 추가 (deploy 전 실행) - 보스 레이드 클라이언트 입장 API (JWT 인증) - Player 프로필 모듈 추가 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -77,19 +77,30 @@ func Load() {
|
||||
}
|
||||
|
||||
// WarnInsecureDefaults logs warnings for security-sensitive settings left at defaults.
|
||||
// In production mode (APP_ENV=production), insecure defaults cause a fatal exit.
|
||||
func WarnInsecureDefaults() {
|
||||
isProd := getEnv("APP_ENV", "") == "production"
|
||||
|
||||
insecure := false
|
||||
if C.JWTSecret == "secret" {
|
||||
log.Println("WARNING: JWT_SECRET is using the default value — set a strong secret for production")
|
||||
insecure = true
|
||||
}
|
||||
if C.RefreshSecret == "refresh-secret" {
|
||||
log.Println("WARNING: REFRESH_SECRET is using the default value — set a strong secret for production")
|
||||
insecure = true
|
||||
}
|
||||
if C.AdminPassword == "admin1234" {
|
||||
log.Println("WARNING: ADMIN_PASSWORD is using the default value — change it for production")
|
||||
insecure = true
|
||||
}
|
||||
if C.WalletEncryptionKey == "" {
|
||||
log.Println("WARNING: WALLET_ENCRYPTION_KEY is empty — blockchain wallet features will fail")
|
||||
}
|
||||
|
||||
if isProd && insecure {
|
||||
log.Fatal("FATAL: insecure default secrets detected in production — set JWT_SECRET, REFRESH_SECRET, and ADMIN_PASSWORD")
|
||||
}
|
||||
}
|
||||
|
||||
func getEnv(key, fallback string) string {
|
||||
|
||||
Reference in New Issue
Block a user