fix: Allow new DATABASE_ env variables to work with migrations/creation (#10216)

* fix: Allow new DATABASE_ env variables to work with migrations/db creation

* Revert
This commit is contained in:
Tom Moor
2025-09-23 02:43:27 +02:00
committed by GitHub
parent a4f77e4438
commit 63c5938a43
3 changed files with 24 additions and 24 deletions

View File

@@ -5,7 +5,7 @@ require("@dotenvx/dotenvx").config({
var path = require('path');
module.exports = {
'config': path.resolve('server/config', 'database.json'),
'config': path.resolve('server/config', 'database.js'),
'migrations-path': path.resolve('server', 'migrations'),
'models-path': path.resolve('server', 'models'),
}

23
server/config/database.js Normal file
View File

@@ -0,0 +1,23 @@
const shared = {
use_env_variable: process.env.DATABASE_URL ? "DATABASE_URL" : undefined,
dialect: "postgres",
host: process.env.DATABASE_HOST,
port: process.env.DATABASE_PORT || 5432,
username: process.env.DATABASE_USER,
password: process.env.DATABASE_PASSWORD || undefined,
database: process.env.DATABASE_NAME,
};
module.exports = {
development: shared,
test: shared,
"production-ssl-disabled": shared,
production: {
...shared,
dialectOptions: {
ssl: {
rejectUnauthorized: false,
},
},
},
};

View File

@@ -1,23 +0,0 @@
{
"development": {
"use_env_variable": "DATABASE_URL",
"dialect": "postgres"
},
"test": {
"use_env_variable": "DATABASE_URL",
"dialect": "postgres"
},
"production": {
"use_env_variable": "DATABASE_URL",
"dialect": "postgres",
"dialectOptions": {
"ssl": {
"rejectUnauthorized": false
}
}
},
"production-ssl-disabled": {
"use_env_variable": "DATABASE_URL",
"dialect": "postgres"
}
}