Skip to content

Commit 38ea927

Browse files
committed
Fix: Updates default MySQL root password
Updates the default MySQL root password across the project. This change ensures consistency and security in development, testing, and CI environments.
1 parent 996d11c commit 38ea927

File tree

6 files changed

+36
-13
lines changed

6 files changed

+36
-13
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ jobs:
4242
mysql:
4343
image: mariadb:10.11
4444
env:
45-
MARIADB_ROOT_PASSWORD: 123
45+
MARIADB_ROOT_PASSWORD: rrd
4646
MARIADB_DATABASE: test_db
4747
ports:
4848
- 3306:3306
4949
options: >-
50-
--health-cmd="mysqladmin ping -h 127.0.0.1 -u root -p123"
50+
--health-cmd="mysqladmin ping -h 127.0.0.1 -u root -prrd"
5151
--health-interval=10s
5252
--health-timeout=5s
5353
--health-retries=3

docs/developer-guide/development-setup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ For MySQL testing, you need a running MySQL instance:
106106
```bash
107107
# Using Docker
108108
docker run --name mysql-test \
109-
-e MYSQL_ROOT_PASSWORD=123 \
109+
-e MYSQL_ROOT_PASSWORD=rrd \
110110
-e MYSQL_DATABASE=test_db \
111111
-p 3306:3306 \
112112
-d mysql:5.7
@@ -116,7 +116,7 @@ export DB_CONNECTOR=mysql
116116
export DB_HOST=localhost
117117
export DB_PORT=3306
118118
export DB_USER=root
119-
export DB_PASSWORD=123
119+
export DB_PASSWORD=rrd
120120
export DB_NAME=test_db
121121
```
122122

docs/developer-guide/testing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ The MySQL test script (`scripts/test-mysql.sh`) automatically:
9797
- Host: `localhost`
9898
- Port: `3306`
9999
- User: `root`
100-
- Password: `123`
100+
- Password: `rrd`
101101
- Database: `test_db`
102102

103103
### PostgreSQL Tests
@@ -135,7 +135,7 @@ The PostgreSQL test script (`scripts/test-postgresql.sh`) automatically:
135135
```bash
136136
# Start MySQL container for testing
137137
docker run --name mysql-test \
138-
-e MYSQL_ROOT_PASSWORD=123 \
138+
-e MYSQL_ROOT_PASSWORD=rrd \
139139
-e MYSQL_DATABASE=test_db \
140140
-p 3306:3306 \
141141
-d mysql:5.7
@@ -449,7 +449,7 @@ The project includes CI configuration that:
449449
**MySQL not running:**
450450
```bash
451451
# Start MySQL with Docker
452-
docker run --name mysql-test -e MYSQL_ROOT_PASSWORD=123 -e MYSQL_DATABASE=test_db -p 3306:3306 -d mysql:5.7
452+
docker run --name mysql-test -e MYSQL_ROOT_PASSWORD=rrd -e MYSQL_DATABASE=test_db -p 3306:3306 -d mysql:5.7
453453
```
454454

455455
**PostgreSQL not running:**

scripts/test-mysql.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export DB_CONNECTOR="mysql"
1010
export DB_HOST=${DB_HOST:-"localhost"}
1111
export DB_PORT=${DB_PORT:-"3306"}
1212
export DB_USER=${DB_USER:-"root"}
13-
export DB_PASSWORD=${DB_PASSWORD:-"123"}
13+
export DB_PASSWORD=${DB_PASSWORD:-"rrd"}
1414
export DB_NAME=${DB_NAME:-"test_db"}
1515

1616
echo "Database configuration:"
@@ -36,7 +36,7 @@ done
3636
# Final check if MySQL is running
3737
if ! mysql -h"$DB_HOST" -P"$DB_PORT" -u"$DB_USER" -e "SELECT 1;" >/dev/null 2>&1; then
3838
echo "Error: Cannot connect to MySQL after multiple retries. Please ensure MySQL is running and accessible."
39-
echo "You can start MySQL with: docker run --name mysql-test -e MYSQL_ROOT_PASSWORD=123 -e MYSQL_DATABASE=test_db -p 3306:3306 -d mysql:5.7"
39+
echo "You can start MySQL with: docker run --name mysql-test -e MYSQL_ROOT_PASSWORD=rrd -e MYSQL_DATABASE=test_db -p 3306:3306 -d mysql:5.7"
4040
exit 1
4141
fi
4242

test/test-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export const getDatabaseConfig = (dbType: DatabaseType): DatabaseConfig => {
111111
host: process.env.DB_HOST || 'localhost',
112112
port: Number.parseInt(process.env.DB_PORT || '3306'),
113113
user: process.env.DB_USER || 'root',
114-
password: process.env.DB_PASSWORD || '123',
114+
password: process.env.DB_PASSWORD || 'rrd',
115115
database: process.env.DB_NAME || 'test_db'
116116
}
117117
}

test/unit/api.register.test.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,38 @@
11
import { describe, it, expect, beforeEach } from 'vitest'
22
import { setup, $fetch } from '@nuxt/test-utils'
3+
import { createUsersTable } from '../../src/runtime/server/utils/create-users-table'
4+
import { createPasswordResetTokensTable } from '../../src/runtime/server/utils/create-password-reset-tokens-table'
5+
import { addActiveToUsers } from '../../src/runtime/server/utils/add-active-to-users'
6+
import type { ModuleOptions } from '../../src/types'
7+
import { defaultOptions } from '../../src/module'
8+
9+
async function setupDatabaseTables() {
10+
// Use the default options which match the playground configuration
11+
// The playground uses SQLite with path './data/users.sqlite3' by default
12+
const options: ModuleOptions = {
13+
...defaultOptions,
14+
connector: {
15+
name: 'sqlite',
16+
options: {
17+
path: './data/users.sqlite3'
18+
}
19+
}
20+
}
21+
22+
// Create all required tables
23+
await createUsersTable(options)
24+
await addActiveToUsers(options)
25+
await createPasswordResetTokensTable(options)
26+
}
327

428
describe('API: Registration', async () => {
529
await setup({
630
rootDir: './playground'
731
})
832

933
beforeEach(async () => {
10-
// Clean up any existing test users
11-
// Clean up any existing test users - we'll use a different approach
12-
// since the DELETE method isn't available on the users endpoint
34+
// Set up database tables before each test
35+
await setupDatabaseTables()
1336
})
1437

1538
it('should register a new user successfully', async () => {

0 commit comments

Comments
 (0)