fix(create-medusa-app): --db-url keep asking db credentials (#11037)

* fix create-medusa-app db-url error

* removed empty lines

* changeset
This commit is contained in:
RONY GEDEON YEBADOKPO
2025-01-29 08:30:18 -05:00
committed by GitHub
parent 2bd51ddc04
commit a16eaad6c9
2 changed files with 12 additions and 6 deletions

View File

@@ -0,0 +1,5 @@
---
"create-medusa-app": patch
---
Fix issue where create-medusa-app repeatedly asked for database credentials even when --db-url was specified. The logic in MedusaProjectCreator->create()->initializeProject()->setupDatabase() always defines a dbName. Updated the getDbClientAndCredentials() method to check db-url first

View File

@@ -226,15 +226,16 @@ export async function getDbClientAndCredentials({
verbose?: boolean
dbName?: string
}> {
if (dbName) {
return await getForDbName({
dbName,
verbose,
})
} else {
// Check the db-url first, because the dbName is always defined in MedusaProjectCreator->create()->initializeProject()->setupDatabase()
if (dbUrl) {
return await getForDbUrl({
dbUrl,
verbose,
})
} else {
return await getForDbName({
dbName,
verbose,
})
}
}