th: sure. why not. let's interpolate DB_HOST.
parent
e60d9bed75
commit
276954bfd0
|
@ -94,6 +94,12 @@ const parseJSON = (json, req) => {
|
||||||
* @returns {Object.<string, any>} the configuration for the PostgreSQL connection
|
* @returns {Object.<string, any>} the configuration for the PostgreSQL connection
|
||||||
*/
|
*/
|
||||||
const pgConfigFromEnv = (env) => {
|
const pgConfigFromEnv = (env) => {
|
||||||
|
if (env.DB_HOST) {
|
||||||
|
env.DB_HOST = env.DB_HOST.replaceAll(/\$\w+|\$\{\w+\}/g, (match) => {
|
||||||
|
const name = match.startsWith('${') ? match.slice(2, -1) : match.slice(1);
|
||||||
|
return env[name];
|
||||||
|
});
|
||||||
|
}
|
||||||
const pgConfigs = {
|
const pgConfigs = {
|
||||||
development: {
|
development: {
|
||||||
user: env.DB_USER || pg.defaults.user,
|
user: env.DB_USER || pg.defaults.user,
|
||||||
|
|
Loading…
Reference in New Issue