use 127.0.0.1 instead if localhost as default host for db

This commit is contained in:
einhornimmond 2025-12-06 16:03:45 +01:00
parent d0a7becc1f
commit 159d63b620
3 changed files with 4 additions and 9 deletions

View File

@ -113,8 +113,7 @@ export class AppDatabase {
database: CONFIG.DB_DATABASE,
port: CONFIG.DB_PORT,
})
// this.drizzleDataSource = drizzle({ client: this.drizzleConnection })
this.drizzleDataSource = drizzle('mysql2://root@127.0.0.1:3306/gradido_test')
this.drizzleDataSource = drizzle({ client: this.drizzleConnection })
}
}

View File

@ -13,7 +13,7 @@ const database = {
DB_CONNECT_RETRY_DELAY_MS: process.env.DB_CONNECT_RETRY_DELAY_MS
? Number.parseInt(process.env.DB_CONNECT_RETRY_DELAY_MS)
: 500,
DB_HOST: process.env.DB_HOST ?? 'localhost',
DB_HOST: process.env.DB_HOST ?? '127.0.0.1',
DB_PORT: process.env.DB_PORT ? Number.parseInt(process.env.DB_PORT) : 3306,
DB_USER: process.env.DB_USER ?? 'root',
DB_PASSWORD: process.env.DB_PASSWORD ?? '',

View File

@ -1,5 +1,5 @@
import { eq } from 'drizzle-orm'
import { drizzle, MySql2Database } from 'drizzle-orm/mysql2'
import { MySql2Database } from 'drizzle-orm/mysql2'
import { AppDatabase, drizzleDb } from '../AppDatabase'
import { openaiThreadsTable } from '../schemas'
import {
@ -15,11 +15,7 @@ let db: MySql2Database
beforeAll(async () => {
await appDB.init()
db = drizzleDb()
try {
await db.delete(openaiThreadsTable)
} catch(e) {
console.error(JSON.stringify(e, null, 2))
}
await db.delete(openaiThreadsTable)
})
afterAll(async () => {
await appDB.destroy()