fix: allow setting DB_PORT and DATABASE_URL env variables (#11519)
Fixes: FRMW-2896 Closes: https://github.com/medusajs/medusa/issues/11502
This commit is contained in:
5
.changeset/sixty-frogs-matter.md
Normal file
5
.changeset/sixty-frogs-matter.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/medusa": patch
|
||||
---
|
||||
|
||||
fix: allow setting DB_PORT and DATABASE_URL env variables
|
||||
@@ -102,6 +102,8 @@ async function generateMigrations(
|
||||
const DB_HOST = process.env.DB_HOST ?? "localhost"
|
||||
const DB_USERNAME = process.env.DB_USERNAME ?? ""
|
||||
const DB_PASSWORD = process.env.DB_PASSWORD ?? ""
|
||||
const DB_PORT = process.env.DB_PORT ? Number(process.env.DB_PORT) : 5432
|
||||
const DATABASE_URL = process.env.DATABASE_URL
|
||||
|
||||
for (const moduleDescriptor of moduleDescriptors) {
|
||||
logger.info(
|
||||
@@ -113,8 +115,10 @@ async function generateMigrations(
|
||||
{
|
||||
entities: moduleDescriptor.entities,
|
||||
host: DB_HOST,
|
||||
port: DB_PORT,
|
||||
user: DB_USERNAME,
|
||||
password: DB_PASSWORD,
|
||||
...(DATABASE_URL ? { clientUrl: DATABASE_URL } : {}),
|
||||
migrations: {
|
||||
path: moduleDescriptor.migrationsPath,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user