fix(create-medusa-app): set the database host and port explicitely (#7637)

* pass host and port explicitely

* set AUTH_CORS in env
This commit is contained in:
Shahed Nasser
2024-06-06 18:26:06 +03:00
committed by GitHub
parent a62a8be016
commit fa0c7dfbb5
3 changed files with 15 additions and 2 deletions
@@ -1,6 +1,6 @@
import { EOL } from "os"
import pg from "pg"
import postgresClient from "./postgres-client.js"
import postgresClient, { DEFAULT_HOST, DEFAULT_PORT } from "./postgres-client.js"
import inquirer from "inquirer"
import logMessage from "./log-message.js"
import formatConnectionString from "./format-connection-string.js"
@@ -66,10 +66,16 @@ async function getForDbName({
let postgresUsername = "postgres"
let postgresPassword = ""
const defaultConnectionOptions = {
host: DEFAULT_HOST,
port: DEFAULT_PORT
}
try {
client = await postgresClient({
user: postgresUsername,
password: postgresPassword,
...defaultConnectionOptions
})
} catch (e) {
if (verbose) {
@@ -103,6 +109,7 @@ async function getForDbName({
client = await postgresClient({
user: postgresUsername,
password: postgresPassword,
...defaultConnectionOptions
})
} catch (e) {
logMessage({