Address production-readiness review: clearer errors, safer votes, and ops hardening.
Distinguish auth/lookup failures, make votes idempotent on visible questions, bound shutdown, page admin users, LRU throttle, trusted-proxy CIDRs, avatar cleanup, versioned migrations, and session cleanup logging.
This commit is contained in:
@@ -63,13 +63,9 @@ func OpenPostgres(databaseURL, schema string) (*sql.DB, *SessionStore, error) {
|
||||
_ = db.Close()
|
||||
return nil, nil, fmt.Errorf("postgres ping: %w", err)
|
||||
}
|
||||
if err := applySchema(db, schema); err != nil {
|
||||
if err := applyMigrations(db, schema); err != nil {
|
||||
_ = db.Close()
|
||||
return nil, nil, fmt.Errorf("apply schema: %w", err)
|
||||
}
|
||||
if err := migrateUserProfileColumns(db); err != nil {
|
||||
_ = db.Close()
|
||||
return nil, nil, fmt.Errorf("migrate profile columns: %w", err)
|
||||
return nil, nil, fmt.Errorf("migrate: %w", err)
|
||||
}
|
||||
sessions := NewSessionStore(db, 5*time.Minute)
|
||||
return db, sessions, nil
|
||||
|
||||
Reference in New Issue
Block a user